diff --git a/flake.nix b/flake.nix index 8aa267bc..5ba55b88 100644 --- a/flake.nix +++ b/flake.nix @@ -79,7 +79,7 @@ }; imageConfigurations = { nixos-linode-img = libx.mkMinImage { hostname = "nixos-linode-img"; format = "linode"; }; - nixos-rpi4-img = libx.mkMinImage { hostname = "nixos-rpi4-img"; format = "sd-aarch64"; }; + nixos-rpi4-img = libx.mkRpiImage { hostname = "nixos-rpi4-img"; format = "sd-aarch64"; }; nixos-iso-console = libx.mkImage { hostname = "nixos-iso-console"; format = "iso"; }; nixos-iso-desktop = libx.mkImage { hostname = "nixos-iso-desktop"; format = "iso"; desktop = "gnome"; }; }; diff --git a/lib/default.nix b/lib/default.nix index a7c329e6..fb3d46cf 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -77,6 +77,32 @@ ]; }; + # Combines mkHost and mkHome for image building + mkRpiImage = { + hostname , + username ? "albert", + desktop ? null, + platform ? "x86_64-linux", + gpu ? null, + theme ? "default", + format + }: inputs.nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs outputs desktop hostname username stateVersion hmStateVersion gpu platform theme format; }; + system = platform; + format = format; + + modules = [ + "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-raspberrypi.nix" + ../nixos + ../nixos/common/modules/installer.nix + inputs.sops-nix.nixosModules.sops + inputs.home-manager.nixosModules.home-manager { + home-manager.extraSpecialArgs = { inherit inputs outputs desktop hostname username hmStateVersion stateVersion gpu platform theme format; }; + home-manager.users."${username}" = import ../home-manager; + } + ]; + }; + # Small version mkMinImage = { hostname ,