users: wire up all user profiles to userSuites and pass to home-manager

This commit is contained in:
Pacman99 2021-03-23 07:36:23 -07:00
parent 416a52fcd3
commit cc52cd9fa2
4 changed files with 21 additions and 5 deletions

3
extern/default.nix vendored
View File

@ -24,4 +24,7 @@
userModules = [ userModules = [
]; ];
# passed to all home-manager modules
userSpecialArgs = {
};
} }

View File

@ -39,6 +39,7 @@ let
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = extern.userSpecialArgs // { suites = suites.user; };
sharedModules = extern.userModules ++ (builtins.attrValues self.homeModules); sharedModules = extern.userModules ++ (builtins.attrValues self.homeModules);
}; };
@ -71,7 +72,7 @@ let
flakeModules = { imports = builtins.attrValues self.nixosModules ++ extern.modules; }; flakeModules = { imports = builtins.attrValues self.nixosModules ++ extern.modules; };
}; };
specialArgs = extern.specialArgs // { inherit suites; }; specialArgs = extern.specialArgs // { suites = suites.system; };
mkHostConfig = hostName: mkHostConfig = hostName:
let let

View File

@ -3,6 +3,7 @@ let
inherit (lib) dev; inherit (lib) dev;
profiles = dev.os.mkProfileAttrs (toString ../profiles); profiles = dev.os.mkProfileAttrs (toString ../profiles);
userProfiles = dev.os.mkProfileAttrs (toString ../users/profiles);
users = dev.os.mkProfileAttrs (toString ../users); users = dev.os.mkProfileAttrs (toString ../users);
allProfiles = allProfiles =
@ -17,7 +18,18 @@ let
suites = with profiles; rec { suites = with profiles; rec {
base = [ users.nixos users.root ]; base = [ users.nixos users.root ];
}; };
# available as 'suites' within the home-manager configuration
userSuites = with userProfiles; rec {
base = [ direnv git ];
};
in in
lib.mapAttrs (_: v: dev.os.profileMap v) suites // { {
system = lib.mapAttrs (_: v: dev.os.profileMap v) suites // {
inherit allProfiles allUsers; inherit allProfiles allUsers;
};
user = lib.mapAttrs (_: v: dev.os.profileMap v) userSuites // {
allProfiles = userProfiles;
};
} }

View File

@ -1,7 +1,7 @@
{ ... }: { ... }:
{ {
home-manager.users.nixos = { home-manager.users.nixos = { suites, ... }: {
imports = [ ../profiles/git ../profiles/direnv ]; imports = suites.base;
}; };
users.users.nixos = { users.users.nixos = {