diff options
| -rw-r--r-- | flake.nix | 21 | ||||
| -rw-r--r-- | installer.nix | 1 |
2 files changed, 18 insertions, 4 deletions
| @@ -41,7 +41,7 @@ | |||
| 41 | accountName' = splitString "@" accountName; | 41 | accountName' = splitString "@" accountName; |
| 42 | in elemAt accountName' 1; | 42 | in elemAt accountName' 1; |
| 43 | 43 | ||
| 44 | mkNixosConfiguration = dir: path: hostName: nixosSystem rec { | 44 | mkNixosConfiguration = addProfiles: dir: path: hostName: nixosSystem rec { |
| 45 | specialArgs = { | 45 | specialArgs = { |
| 46 | flake = self; | 46 | flake = self; |
| 47 | flakeInputs = inputs; | 47 | flakeInputs = inputs; |
| @@ -60,7 +60,7 @@ | |||
| 60 | }; | 60 | }; |
| 61 | accountModules = attrValues (filterAttrs accountMatchesHost self.nixosModules.accounts); | 61 | accountModules = attrValues (filterAttrs accountMatchesHost self.nixosModules.accounts); |
| 62 | accountMatchesHost = n: _v: accountHostName n == hostName; | 62 | accountMatchesHost = n: _v: accountHostName n == hostName; |
| 63 | in attrValues (filterAttrs (n: _v: !(elem n ["systemProfiles" "users" "userProfiles" "accounts"])) self.nixosModules) ++ [ argsModule ] ++ defaultProfiles ++ [ local ] ++ accountModules; | 63 | in attrValues (filterAttrs (n: _v: !(elem n ["systemProfiles" "users" "userProfiles" "accounts"])) self.nixosModules) ++ [ argsModule ] ++ defaultProfiles ++ addProfiles ++ [ local ] ++ accountModules; |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | mkSystemProfile = dir: path: profileName: { | 66 | mkSystemProfile = dir: path: profileName: { |
| @@ -110,6 +110,19 @@ | |||
| 110 | activateNixosConfigurations = forAllSystems (system: _pkgs: mapAttrs' (hostName: nixosConfig: nameValuePair "${hostName}-activate" { type = "app"; program = "${nixosConfig.config.system.build.toplevel}/bin/switch-to-configuration"; }) self.nixosConfigurations); | 110 | activateNixosConfigurations = forAllSystems (system: _pkgs: mapAttrs' (hostName: nixosConfig: nameValuePair "${hostName}-activate" { type = "app"; program = "${nixosConfig.config.system.build.toplevel}/bin/switch-to-configuration"; }) self.nixosConfigurations); |
| 111 | 111 | ||
| 112 | overlayPaths = recImport rec { dir = ./overlays; _import = (path: _name: dir + "/${path}"); } // { pkgs = ./pkgs; }; | 112 | overlayPaths = recImport rec { dir = ./overlays; _import = (path: _name: dir + "/${path}"); } // { pkgs = ./pkgs; }; |
| 113 | |||
| 114 | installerProfiles = system: | ||
| 115 | let nixpkgs-path = nixpkgs.legacyPackages.${system}.path; | ||
| 116 | in mapAttrs (name: {path, output}: { profile = mkSystemProfile nixpkgs-path path "installer-${name}"; inherit output; }) | ||
| 117 | { cd-dvd = { path = "nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"; output = out: out.config.system.build.isoImage; }; | ||
| 118 | netboot = { path = "nixos/modules/installer/netboot/netboot-minimal.nix"; output = out: (self.legacyPackages.${system}.symlinkJoin { name = "netboot"; paths = with out.config.system.build; [ netbootRamdisk kernel netbootIpxeScript ]; preferLocalBuild = true; }); }; | ||
| 119 | }; | ||
| 120 | |||
| 121 | installers = | ||
| 122 | let mkInstallers = system: mapAttrs (mkInstaller system) (installerProfiles system); | ||
| 123 | mkInstaller = system: name: {profile, output}: output (mkNixosConfiguration [profile { config = { nixpkgs.system = system; }; }] ./. installerConfig "installer"); | ||
| 124 | installerConfig = if builtins.pathExists ./installer.nix then "installer.nix" else (if builtins.pathExists ./installer then "installer" else null); | ||
| 125 | in if !(builtins.isNull installerConfig) then { installers = forAllSystems (system: _systemPkgs: mkInstallers system); } else {}; | ||
| 113 | in | 126 | in |
| 114 | { | 127 | { |
| 115 | nixosModules = | 128 | nixosModules = |
| @@ -120,7 +133,7 @@ | |||
| 120 | accounts = recursiveUpdate rootAccounts (recImport rec { dir = ./accounts; _import = mkAccountModule dir; }); | 133 | accounts = recursiveUpdate rootAccounts (recImport rec { dir = ./accounts; _import = mkAccountModule dir; }); |
| 121 | rootAccounts = mapAttrs' (hostName: _value: nameValuePair "root@${hostName}" ({...}: { imports = [ self.nixosModules.users.root or ({...}: { imports = defaultUserProfiles "root"; }) ]; })) self.nixosConfigurations; | 134 | rootAccounts = mapAttrs' (hostName: _value: nameValuePair "root@${hostName}" ({...}: { imports = [ self.nixosModules.users.root or ({...}: { imports = defaultUserProfiles "root"; }) ]; })) self.nixosConfigurations; |
| 122 | in modulesAttrs // { inherit systemProfiles users userProfiles accounts; }; | 135 | in modulesAttrs // { inherit systemProfiles users userProfiles accounts; }; |
| 123 | nixosConfigurations = recImport rec { dir = ./hosts; _import = mkNixosConfiguration dir; }; | 136 | nixosConfigurations = recImport rec { dir = ./hosts; _import = mkNixosConfiguration [] dir; }; |
| 124 | 137 | ||
| 125 | homeManagerModules = recImport rec { dir = ./home-modules; }; | 138 | homeManagerModules = recImport rec { dir = ./home-modules; }; |
| 126 | 139 | ||
| @@ -142,5 +155,5 @@ | |||
| 142 | path = ./.; | 155 | path = ./.; |
| 143 | description = "GKleen's flakey nixos configuration"; | 156 | description = "GKleen's flakey nixos configuration"; |
| 144 | }; | 157 | }; |
| 145 | }; | 158 | } // installers; |
| 146 | } | 159 | } |
diff --git a/installer.nix b/installer.nix new file mode 100644 index 00000000..64629674 --- /dev/null +++ b/installer.nix | |||
| @@ -0,0 +1 @@ | |||
| {...}: {} | |||
