From 0f5a49ab551bb14a3b6251524fdde41e62d8903d Mon Sep 17 00:00:00 2001 From: 514fpv Date: Mon, 29 Apr 2024 22:36:32 +0800 Subject: [PATCH] feat(koumakyou): initial configuration --- flake.lock | 60 ++++++++++++++++++++++++++++++++- flake.nix | 3 ++ global/auth/pub/koumakyou.pub | 1 + spec/koumakyou/default.nix | 63 ++++++++++++++++++----------------- spec/koumakyou/jovian.nix | 28 ++++++++++++++++ 5 files changed, 124 insertions(+), 31 deletions(-) create mode 100644 global/auth/pub/koumakyou.pub create mode 100644 spec/koumakyou/jovian.nix diff --git a/flake.lock b/flake.lock index e094042a..18ece039 100644 --- a/flake.lock +++ b/flake.lock @@ -184,6 +184,25 @@ "type": "github" } }, + "jovian": { + "inputs": { + "nix-github-actions": "nix-github-actions", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1714235105, + "narHash": "sha256-QCEp+JZOQzFWsNSs3KMCAMf4Ik+YglNdrQJXq10yYaw=", + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "rev": "03448a4e169d4590d21138f0ac65ab64bd1a2d85", + "type": "github" + }, + "original": { + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "type": "github" + } + }, "lanzaboote": { "inputs": { "crane": "crane", @@ -211,6 +230,28 @@ "type": "github" } }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "jovian", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1690328911, + "narHash": "sha256-fxtExYk+aGf2YbjeWQ8JY9/n9dwuEt+ma1eUFzF8Jeo=", + "owner": "zhaofengli", + "repo": "nix-github-actions", + "rev": "96df4a39c52f53cb7098b923224d8ce941b64747", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "ref": "matrix-name", + "repo": "nix-github-actions", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1714076141, @@ -243,6 +284,22 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1714076141, + "narHash": "sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7bb2ccd8cdc44c91edba16c48d2c8f331fb3d856", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "pre-commit-hooks-nix": { "inputs": { "flake-compat": [ @@ -280,8 +337,9 @@ "flake-utils": "flake-utils", "home-manager": "home-manager", "impermanence": "impermanence", + "jovian": "jovian", "lanzaboote": "lanzaboote", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" } }, "rust-overlay": { diff --git a/flake.nix b/flake.nix index 14cf472b..565ff4ae 100644 --- a/flake.nix +++ b/flake.nix @@ -11,6 +11,9 @@ home-manager.inputs.nixpkgs.follows = "nixpkgs"; lanzaboote.url = "github:nix-community/lanzaboote/v0.3.0"; lanzaboote.inputs.nixpkgs.follows = "nixpkgs"; + + # steamdeck + jovian.url = "github:Jovian-Experiments/Jovian-NixOS"; }; outputs = inputs: diff --git a/global/auth/pub/koumakyou.pub b/global/auth/pub/koumakyou.pub new file mode 100644 index 00000000..305fe6a9 --- /dev/null +++ b/global/auth/pub/koumakyou.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINJOoXrfB4D8Vi6HH4E7RqHHIWhPPqEiiOeLRfggW1XZ koishi@koumakyou diff --git a/spec/koumakyou/default.nix b/spec/koumakyou/default.nix index c6a8f17c..bda72da0 100644 --- a/spec/koumakyou/default.nix +++ b/spec/koumakyou/default.nix @@ -1,51 +1,54 @@ -{ pkgs -, lib -, ... }: { +{ pkgs, lib, config, ... }: { global = { - id = "eeb44fb1150944aab7d146b7caad789f"; - auth.openssh.enable = true; - fs.esp.uuid = "B20E-5994"; + id = "0a920a834b5f480bab258040096d4c6e"; + fs.esp.uuid = "ACB3-4AFF"; fs.type = "xfs"; - fs.store = "e8eea851-51b0-4c29-80c4-3d9358c4f3f8"; - fs.external.enable = true; - fs.external.device = "/dev/disk/by-uuid/f0e13b58-1223-479c-b673-3a8e629c7f72"; - fs.external.fsType = "ext4"; + fs.store = "6b885fa6-5c13-4a46-94da-a287232606b9"; fs.cryptsetup.enable = true; - fs.cryptsetup.uuids.nix = "84baa53a-c76d-4716-813a-196f5a53e44d"; - fs.cryptsetup.uuids.persist = "e31f8b1c-6504-4b43-93dd-997ad17ebf5e"; + fs.cryptsetup.uuids.persist = "b4a5a66d-b491-4ac7-bc71-1ea8b1a503be"; boot.lanzaboote = true; gpu.enable = true; - gpu.type = "prime"; - asusd.enable = true; - oci.enable = true; + gpu.type = "amdgpu"; }; home = { - gnome.enable = true; - gyroflow.enable = true; + vscode.enable = true; minecraft.enable = true; - minecraft.allUsers = true; - steam.enable = true; - steam.allUsers = true; }; + users.homeModules = [ { + wayland.windowManager.sway.config = { + input."1046:911:Goodix_Capacitive_TouchScreen".map_to_output = "eDP-1"; + output = { + eDP-1.scale = "1.75"; + }; + }; + } ]; + powerManagement.enable = true; powerManagement.cpuFreqGovernor = "performance"; + powerManagement.resumeCommands = '' + # trackpad driver resume workaround + ${pkgs.kmod}/bin/modprobe -r bmi260_i2c + ${pkgs.kmod}/bin/modprobe -r bmi260_core + ${pkgs.kmod}/bin/modprobe bmi260_i2c + ${pkgs.kmod}/bin/modprobe bmi260_core + ''; - hardware.nvidia.prime = { - amdgpuBusId = "PCI:6:0:0"; - nvidiaBusId = "PCI:1:0:0"; - }; - imports = lib.pipe ./. [ - builtins.readDir - (lib.filterAttrs (n: ty: ty == "regular" && n != "default.nix")) - (lib.mapAttrsToList (n: _: ./${n})) - ]; + services.greetd.settings.default_session.command = let + cfg = config.programs.regreet; + in "${pkgs.dbus}/bin/dbus-run-session ${lib.getExe pkgs.cage} ${lib.escapeShellArgs cfg.cageArgs} -- ${pkgs.writeShellScript "cageResolution" '' + ${lib.getExe pkgs.wlr-randr} --output eDP-1 --scale 2 + ${lib.getExe cfg.package} + ''}"; hardware.enableRedistributableFirmware = true; - boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "ahci" "sd_mod" ]; + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; + hardware.cpu.intel.updateMicrocode = true; + + imports = [ ./jovian.nix ]; } diff --git a/spec/koumakyou/jovian.nix b/spec/koumakyou/jovian.nix new file mode 100644 index 00000000..69ee35f3 --- /dev/null +++ b/spec/koumakyou/jovian.nix @@ -0,0 +1,28 @@ +{ jovian, ... }: { + jovian = { + hardware.has.amd.gpu = true; + steamos.useSteamOSConfig = true; + + steam = { + enable = true; + user = "app"; + #desktopSession + }; + + decky-loader = { + enable = true; + stateDir = "/nix/persist/decky"; + }; + }; + + users.home.persistApp.directories = [ + ".steam" ".local/share/Steam" ".config/gamescope" + ]; + + users.users.decky.uid = 514; + users.groups.decky.gid = 514; + + imports = [ + jovian.nixosModules.jovian + ]; +}