diff options
| -rw-r--r-- | flake.nix | 10 |
1 files changed, 5 insertions, 5 deletions
| @@ -26,11 +26,11 @@ | |||
| 26 | 26 | ||
| 27 | outputs = { self, nixpkgs, home-manager, sops-nix }@inputs: | 27 | outputs = { self, nixpkgs, home-manager, sops-nix }@inputs: |
| 28 | let | 28 | let |
| 29 | inherit (builtins) attrNames attrValues elemAt toJSON; | 29 | inherit (builtins) attrNames attrValues elemAt toJSON isNull pathExists; |
| 30 | inherit (nixpkgs) lib; | 30 | inherit (nixpkgs) lib; |
| 31 | utils = import ./utils { inherit lib; }; | 31 | utils = import ./utils { inherit lib; }; |
| 32 | inherit (utils) recImport overrideModule; | 32 | inherit (utils) recImport overrideModule; |
| 33 | inherit (lib) nixosSystem mkIf splitString filterAttrs listToAttrs mapAttrsToList nameValuePair concatMap composeManyExtensions mapAttrs mapAttrs' recursiveUpdate genAttrs unique elem; | 33 | inherit (lib) nixosSystem mkIf splitString filterAttrs listToAttrs mapAttrsToList nameValuePair concatMap composeManyExtensions mapAttrs mapAttrs' recursiveUpdate genAttrs unique elem optionalAttrs; |
| 34 | 34 | ||
| 35 | accountUserName = accountName: | 35 | accountUserName = accountName: |
| 36 | let | 36 | let |
| @@ -118,11 +118,11 @@ | |||
| 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; }); }; | 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 | }; | 119 | }; |
| 120 | 120 | ||
| 121 | installerConfig = if pathExists ./installer.nix then "installer.nix" else (if pathExists ./installer then "installer" else null); | ||
| 121 | installers = | 122 | installers = |
| 122 | let mkInstallers = system: mapAttrs (mkInstaller system) (installerProfiles system); | 123 | let mkInstallers = system: mapAttrs (mkInstaller system) (installerProfiles system); |
| 123 | mkInstaller = system: name: {profile, output}: output (mkNixosConfiguration [profile { config = { nixpkgs.system = system; }; }] ./. installerConfig "installer"); | 124 | 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 !(isNull installerConfig) then { installers = forAllSystems (system: _systemPkgs: mkInstallers system); } else {}; |
| 125 | in if !(builtins.isNull installerConfig) then { installers = forAllSystems (system: _systemPkgs: mkInstallers system); } else {}; | ||
| 126 | in | 126 | in |
| 127 | { | 127 | { |
| 128 | nixosModules = | 128 | nixosModules = |
| @@ -133,7 +133,7 @@ | |||
| 133 | accounts = recursiveUpdate rootAccounts (recImport rec { dir = ./accounts; _import = mkAccountModule dir; }); | 133 | accounts = recursiveUpdate rootAccounts (recImport rec { dir = ./accounts; _import = mkAccountModule dir; }); |
| 134 | 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; |
| 135 | in modulesAttrs // { inherit systemProfiles users userProfiles accounts; }; | 135 | in modulesAttrs // { inherit systemProfiles users userProfiles accounts; }; |
| 136 | nixosConfigurations = recImport rec { dir = ./hosts; _import = mkNixosConfiguration [] dir; }; | 136 | nixosConfigurations = optionalAttrs (!(isNull installerConfig)) { installer = installerConfig; } // recImport rec { dir = ./hosts; _import = mkNixosConfiguration [] dir; }; |
| 137 | 137 | ||
| 138 | homeManagerModules = recImport rec { dir = ./home-modules; }; | 138 | homeManagerModules = recImport rec { dir = ./home-modules; }; |
| 139 | 139 | ||
