diff --git a/flake.nix b/flake.nix index f3979204..7ceb3bf0 100644 --- a/flake.nix +++ b/flake.nix @@ -20,8 +20,6 @@ libx = import ./lib { inherit inputs outputs stateVersion hmStateVersion; }; in { nixosConfigurations = { - # Generic Images / ISOs - nixos-rpi4-img = libx.mkHost { hostname = "nixos-rpi4-img"; platform = "aarch64-linux"; installer = nixpkgs + "/nixos/modules/installer/sd-card/sd-image-aarch64.nix"; }; # Virtual Machines nixos-vm-01 = libx.mkHost { hostname = "nixos-vm-01"; }; # Physical Machines @@ -32,8 +30,6 @@ nixos-rpi4-03 = libx.mkHost { hostname = "nixos-rpi4-03"; platform = "aarch64-linux"; }; }; homeConfigurations = { - # Generic Images / ISOs - "albert@nixos-rpi4-img" = libx.mkHome { hostname = "nixos-rpi4-img"; platform = "aarch64-linux"; }; # Virtual Machines "albert@nixos-vm-01" = libx.mkHome { hostname = "nixos-vm-01"; }; # Physical Machines @@ -43,5 +39,9 @@ "albert@nixos-rpi4-02" = libx.mkHome { hostname = "nixos-rpi4-02"; platform = "aarch64-linux"; }; "albert@nixos-rpi4-03" = libx.mkHome { hostname = "nixos-rpi4-03"; platform = "aarch64-linux"; }; }; + imageConfigurations = { + # Raspberry Pi 4 Image + nixos-rpi4-img = libx.mkImage { hostname = "nixos-rpi4-img"; platform = "aarch64-linux"; installer = nixpkgs + "/nixos/modules/installer/sd-card/sd-image-aarch64.nix"; }; + }; }; } \ No newline at end of file diff --git a/lib/default.nix b/lib/default.nix index 89c99e5e..ac6b4c93 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -34,6 +34,22 @@ ] ++ (inputs.nixpkgs.lib.optionals (installer != null) [ installer ]); }; + # Combines mkHost and mkHome for image building + mkImage = { + hostname, + username ? "albert", + desktop ? null, + platform ? "x86_64-linux", + theme ? "default", + installer ? null, + gpu ? null, + theme ? "default" + }: { + specialArgs = { inherit inputs outputs desktop hostname username stateVersion gpu platform theme; }; + hostname = mkHost { hostname = hostname; platform = platform; installer = installer; }; + "$username@$hostname" = mkHome { hostname = hostname; platform = platform; }; + }; + forAllSystems = inputs.nixpkgs.lib.genAttrs [ "aarch64-linux" "i686-linux"