summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2021-05-15 22:15:06 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2021-05-15 22:15:06 +0200
commit3e5346ccfd542e9abb928a7eca2e831b9c30df2e (patch)
treee46fc69e1d022554780cedf91d0d55745e5e61e3
parent989d80d2da3d7a71b1a7af9d6cab9a162ae04229 (diff)
downloadnixos-3e5346ccfd542e9abb928a7eca2e831b9c30df2e.tar
nixos-3e5346ccfd542e9abb928a7eca2e831b9c30df2e.tar.gz
nixos-3e5346ccfd542e9abb928a7eca2e831b9c30df2e.tar.bz2
nixos-3e5346ccfd542e9abb928a7eca2e831b9c30df2e.tar.xz
nixos-3e5346ccfd542e9abb928a7eca2e831b9c30df2e.zip
better name nixImport
-rw-r--r--flake.nix18
-rw-r--r--utils/default.nix2
2 files changed, 10 insertions, 10 deletions
diff --git a/flake.nix b/flake.nix
index ea3d0747..d8684703 100644
--- a/flake.nix
+++ b/flake.nix
@@ -29,7 +29,7 @@
29 inherit (builtins) attrNames attrValues elemAt toJSON isNull pathExists; 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) nixImport overrideModule;
33 inherit (lib) nixosSystem mkIf splitString filterAttrs listToAttrs mapAttrsToList nameValuePair concatMap composeManyExtensions mapAttrs mapAttrs' recursiveUpdate genAttrs unique elem optionalAttrs; 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:
@@ -109,7 +109,7 @@
109 109
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 = nixImport rec { dir = ./overlays; _import = (path: _name: dir + "/${path}"); } // { pkgs = ./pkgs; };
113 113
114 installerProfiles = system: 114 installerProfiles = system:
115 let nixpkgs-path = nixpkgs.legacyPackages.${system}.path; 115 let nixpkgs-path = nixpkgs.legacyPackages.${system}.path;
@@ -126,16 +126,16 @@
126 in 126 in
127 { 127 {
128 nixosModules = 128 nixosModules =
129 let modulesAttrs = recImport { dir = ./modules; }; 129 let modulesAttrs = nixImport { dir = ./modules; };
130 systemProfiles = recImport rec { dir = ./system-profiles; _import = mkSystemProfile dir; }; 130 systemProfiles = nixImport rec { dir = ./system-profiles; _import = mkSystemProfile dir; };
131 users = recImport rec { dir = ./users; _import = mkUserModule dir; }; 131 users = nixImport rec { dir = ./users; _import = mkUserModule dir; };
132 userProfiles = forAllUsers (userName: recImport rec { dir = ./user-profiles; _import = mkUserProfile userName dir; }); 132 userProfiles = forAllUsers (userName: nixImport rec { dir = ./user-profiles; _import = mkUserProfile userName dir; });
133 accounts = recursiveUpdate rootAccounts (recImport rec { dir = ./accounts; _import = mkAccountModule dir; }); 133 accounts = recursiveUpdate rootAccounts (nixImport 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 = optionalAttrs (!(isNull installerConfig)) { installer = installerConfig; } // recImport rec { dir = ./hosts; _import = mkNixosConfiguration [] dir; }; 136 nixosConfigurations = optionalAttrs (!(isNull installerConfig)) { installer = installerConfig; } // nixImport rec { dir = ./hosts; _import = mkNixosConfiguration [] dir; };
137 137
138 homeManagerModules = recImport rec { dir = ./home-modules; }; 138 homeManagerModules = nixImport rec { dir = ./home-modules; };
139 139
140 overlay = import overlayPaths.pkgs; 140 overlay = import overlayPaths.pkgs;
141 overlays = mapAttrs (_name: path: import path) overlayPaths; 141 overlays = mapAttrs (_name: path: import path) overlayPaths;
diff --git a/utils/default.nix b/utils/default.nix
index d00357af..48add212 100644
--- a/utils/default.nix
+++ b/utils/default.nix
@@ -3,7 +3,7 @@ rec {
3 inherit (builtins) readDir; 3 inherit (builtins) readDir;
4 inherit (lib) filterAttrs hasSuffix removeSuffix mapAttrs' nameValuePair isFunction functionArgs setFunctionArgs id; 4 inherit (lib) filterAttrs hasSuffix removeSuffix mapAttrs' nameValuePair isFunction functionArgs setFunctionArgs id;
5 mapFilterAttrs = seive: f: attrs: filterAttrs seive (mapAttrs' f attrs); 5 mapFilterAttrs = seive: f: attrs: filterAttrs seive (mapAttrs' f attrs);
6 recImport = { dir, _import ? name: _base: import "${toString dir}/${name}" }: 6 nixImport = { dir, _import ? name: _base: import "${toString dir}/${name}" }:
7 mapFilterAttrs 7 mapFilterAttrs
8 (_: v: v != null) 8 (_: v: v != null)
9 (n: v: 9 (n: v: