From 2fe122ea542427a2214b6c69eac8ac1ec70bf6d7 Mon Sep 17 00:00:00 2001 From: albert Date: Fri, 26 Apr 2024 20:49:35 +0900 Subject: [PATCH] Updates --- flake.nix | 6 +-- lib/default.nix | 72 +++++++++++++++++++++++-------- nixos/hosts/steamdeck/default.nix | 5 ++- 3 files changed, 60 insertions(+), 23 deletions(-) diff --git a/flake.nix b/flake.nix index dc0037ef..aeb8a9af 100644 --- a/flake.nix +++ b/flake.nix @@ -50,7 +50,7 @@ # Steam Deck configs for NixOS jovian.url = "github:Jovian-Experiments/Jovian-NixOS"; }; - outputs = { self, nixpkgs, nixpkgs-wayland, home-manager, lanzaboote, nur, sops-nix, doom-emacs, nixos-generators, deploy-rs, ... } @inputs: + outputs = { self, nixpkgs, nixpkgs-wayland, home-manager, lanzaboote, nur, sops-nix, doom-emacs, nixos-generators, deploy-rs, jovian, ... } @inputs: let inherit (self) outputs; stateVersion = "23.11"; @@ -68,7 +68,7 @@ piaware-rpi4 = libx.mkHost { hostname = "piaware-rpi4"; system = "aarch64-linux"; type = "small"; }; quitman-rpi4 = libx.mkHost { hostname = "quitman-rpi4"; system = "aarch64-linux"; type = "small"; }; bakersfield-rpi4 = libx.mkHost { hostname = "bakersfield-rpi4"; system = "aarch64-linux"; type = "small"; }; - steamdeck = libx.mkHost { hostname = "steamdeck"; unfree = true; desktop = "plasma6"; repo = "nixpkgs-unstable"; }; + steamdeck = libx.mkDeck { hostname = "steamdeck"; type = "small"; }; }; homeConfigurations = { "albert@osaka-linode-01" = libx.mkHome { hostname = "osaka-linode-01"; type = "small"; }; @@ -81,7 +81,7 @@ "albert@piaware-rpi4" = libx.mkHome { hostname = "piaware-rpi4"; system = "aarch64-linux"; type = "small"; }; "albert@quitman-rpi4" = libx.mkHome { hostname = "quitman-rpi4"; system = "aarch64-linux"; type = "small"; }; "albert@bakersfield-rpi4" = libx.mkHome { hostname = "bakersfield-rpi4"; system = "aarch64-linux"; type = "small"; }; - "albert@steamdeck" = libx.mkHome { hostname = "steamdeck"; desktop = "plasma6"; }; + "albert@steamdeck" = libx.mkHome { hostname = "steamdeck"; type = "small"; }; # Containers "albert@rdesktop" = libx.mkHome { hostname = "rdesktop"; desktop = "xfce"; }; }; diff --git a/lib/default.nix b/lib/default.nix index c94094c7..06bacdf8 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -68,10 +68,45 @@ imports = [ ../nixos/containers inputs.sops-nix.nixosModules.sops + inputs.home-manager.nixosModules.home-manager { + home-manager.extraSpecialArgs = { inherit inputs outputs desktop hostname username hmStateVersion stateVersion system theme ; }; + home-manager.users."${username}" = import ../home-manager; + } ]; }; }; + # Helper function for generating host configs + mkDeck = { + hostname, + username ? "albert", + desktop ? null, + gpu ? null, + system ? "x86_64-linux", + theme ? "stylix", + type ? "default", + repo ? "nixpkgs-unstable", + unfree ? false + }: inputs.${repo}.lib.nixosSystem { + specialArgs = { + inherit inputs outputs desktop hostname username hmStateVersion stateVersion gpu system theme self; + # Some packages (ie, Vintage Story) I want to keep on unstable no matter what default repo I use + pkgs-unstable = import inputs.nixpkgs-unstable { + inherit system; + config.allowUnfree = unfree; + hostPlatform = system; + }; + }; + + modules = [ + # Types are 'default', 'small', and 'minimal' + ../nixos/minimal.nix + inputs.sops-nix.nixosModules.sops + inputs.lanzaboote.nixosModules.lanzaboote + ]; + }; + + # Helper function for generating host configs mkHost = { hostname, @@ -84,26 +119,27 @@ repo ? "nixpkgs", unfree ? false }: inputs.${repo}.lib.nixosSystem { - specialArgs = { inherit inputs outputs desktop hostname username hmStateVersion stateVersion gpu system theme self; - # Choose whether to pull from stable or unstable - pkgs = import inputs.${repo} { - inherit system; - config.allowUnfree = unfree; - hostPlatform = system; + specialArgs = { + inherit inputs outputs desktop hostname username hmStateVersion stateVersion gpu system theme self; + # Choose whether to pull from stable or unstable + pkgs = import inputs.${repo} { + inherit system; + config.allowUnfree = unfree; + hostPlatform = system; + }; + # Some packages (ie, Vintage Story) I want to keep on unstable no matter what default repo I use + pkgs-unstable = import inputs.nixpkgs-unstable { + inherit system; + config.allowUnfree = unfree; + hostPlatform = system; + }; }; - # Some packages (ie, Vintage Story) I want to keep on unstable no matter what default repo I use - pkgs-unstable = import inputs.nixpkgs-unstable { - inherit system; - config.allowUnfree = unfree; - hostPlatform = system; - }; - }; - modules = [ - # Types are 'default', 'small', and 'minimal' - ../nixos/${type}.nix - inputs.sops-nix.nixosModules.sops - inputs.lanzaboote.nixosModules.lanzaboote + modules = [ + # Types are 'default', 'small', and 'minimal' + ../nixos/${type}.nix + inputs.sops-nix.nixosModules.sops + inputs.lanzaboote.nixosModules.lanzaboote ]; }; diff --git a/nixos/hosts/steamdeck/default.nix b/nixos/hosts/steamdeck/default.nix index a66bd0d3..828a4c75 100644 --- a/nixos/hosts/steamdeck/default.nix +++ b/nixos/hosts/steamdeck/default.nix @@ -6,6 +6,7 @@ ../../common/services/tailscale-autoconnect.nix ]; + nixpkgs.config.allowUnfree = true; boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "thunderbolt" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" "acpi_call" ]; @@ -27,6 +28,6 @@ steam.user = username; steamos.useSteamOSConfig = true; devices.steamdeck.enable = true; - hardwarhas.amd.gpu = true; - }; + hardware.has.amd.gpu = true; + }; }