summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2021-05-15 22:13:55 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2021-05-15 22:13:55 +0200
commit989d80d2da3d7a71b1a7af9d6cab9a162ae04229 (patch)
tree8dc513b133a331bc5e0b66dbb69d8b387039155a
parentdf02e465133be72aafbb083c16d80188cc8f1b13 (diff)
downloadnixos-989d80d2da3d7a71b1a7af9d6cab9a162ae04229.tar
nixos-989d80d2da3d7a71b1a7af9d6cab9a162ae04229.tar.gz
nixos-989d80d2da3d7a71b1a7af9d6cab9a162ae04229.tar.bz2
nixos-989d80d2da3d7a71b1a7af9d6cab9a162ae04229.tar.xz
nixos-989d80d2da3d7a71b1a7af9d6cab9a162ae04229.zip
fix root account on installers
-rw-r--r--flake.nix10
1 files changed, 5 insertions, 5 deletions
diff --git a/flake.nix b/flake.nix
index e2567e84..ea3d0747 100644
--- a/flake.nix
+++ b/flake.nix
@@ -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