diff options
-rw-r--r-- | flake.nix | 4 | ||||
-rw-r--r-- | system-profiles/core.nix | 21 | ||||
-rw-r--r-- | user-profiles/core.nix | 28 |
3 files changed, 27 insertions, 26 deletions
@@ -79,7 +79,7 @@ | |||
79 | (inputs: inputs // { inherit userName; }) | 79 | (inputs: inputs // { inherit userName; }) |
80 | (outputs: { _file = dir + "/${path}"; } | 80 | (outputs: { _file = dir + "/${path}"; } |
81 | // outputs | 81 | // outputs |
82 | // { imports = [self.nixosModules.userProfiles.${userName}.core] ++ (outputs.imports or []); }); | 82 | // { imports = defaultUserProfiles userName ++ (outputs.imports or []); }); |
83 | 83 | ||
84 | mkUserProfile = userName: dir: path: profileName: | 84 | mkUserProfile = userName: dir: path: profileName: |
85 | let | 85 | let |
@@ -102,7 +102,7 @@ | |||
102 | (inputs: inputs // { inherit userName; }) | 102 | (inputs: inputs // { inherit userName; }) |
103 | (outputs: { _file = dir + "/${path}"; } | 103 | (outputs: { _file = dir + "/${path}"; } |
104 | // outputs | 104 | // outputs |
105 | // { imports = defaultUserProfiles userName ++ (outputs.imports or []); }); | 105 | // { imports = [self.nixosModules.users.${userName} or ({...}: { imports = defaultUserProfiles userName; })] ++ (outputs.imports or []); }); |
106 | 106 | ||
107 | forAllSystems = f: mapAttrs f nixpkgs.legacyPackages; | 107 | forAllSystems = f: mapAttrs f nixpkgs.legacyPackages; |
108 | forAllUsers = genAttrs (unique (map accountUserName (attrNames self.nixosModules.accounts))); | 108 | forAllUsers = genAttrs (unique (map accountUserName (attrNames self.nixosModules.accounts))); |
diff --git a/system-profiles/core.nix b/system-profiles/core.nix index 79c2fe82..5f2433bb 100644 --- a/system-profiles/core.nix +++ b/system-profiles/core.nix | |||
@@ -1,6 +1,8 @@ | |||
1 | { flake, flakeInputs, path, hostName, config, lib, pkgs, customUtils, ... }: | 1 | { flake, flakeInputs, path, hostName, config, lib, pkgs, customUtils, ... }: |
2 | let | 2 | let |
3 | profileSet = customUtils.types.attrNameSet flake.nixosModules.systemProfiles; | 3 | profileSet = customUtils.types.attrNameSet flake.nixosModules.systemProfiles; |
4 | userProfileSet = customUtils.types.attrNameSet (lib.zipAttrs (lib.attrValues flake.nixosModules.userProfiles)); | ||
5 | hasSops = config.sops.secrets != {}; | ||
4 | in { | 6 | in { |
5 | imports = with flakeInputs; | 7 | imports = with flakeInputs; |
6 | [ sops-nix.nixosModules.sops | 8 | [ sops-nix.nixosModules.sops |
@@ -16,6 +18,18 @@ in { | |||
16 | Set (list without duplicates) of ‘systemProfiles’ enabled for this host | 18 | Set (list without duplicates) of ‘systemProfiles’ enabled for this host |
17 | ''; | 19 | ''; |
18 | }; | 20 | }; |
21 | |||
22 | users.users = lib.mkOption { | ||
23 | type = lib.types.attrsOf (lib.types.submodule { | ||
24 | options.profiles = lib.mkOption { | ||
25 | type = userProfileSet; | ||
26 | default = []; | ||
27 | description = '' | ||
28 | Set (list without duplicates) of ‘userProfiles’ enabled for this user | ||
29 | ''; | ||
30 | }; | ||
31 | }); | ||
32 | }; | ||
19 | }; | 33 | }; |
20 | 34 | ||
21 | config = { | 35 | config = { |
@@ -48,6 +62,11 @@ in { | |||
48 | 62 | ||
49 | # documentation.nixos.includeAllModules = true; # incompatible with home-manager (build fails) | 63 | # documentation.nixos.includeAllModules = true; # incompatible with home-manager (build fails) |
50 | 64 | ||
51 | home-manager.useGlobalPkgs = true; # Otherwise home-manager would only work impurely | 65 | home-manager = { |
66 | useGlobalPkgs = true; # Otherwise home-manager would only work impurely | ||
67 | useUserPackages = true; | ||
68 | }; | ||
69 | |||
70 | sops.gnupgHome = lib.mkIf hasSops "/root/.gnupg"; | ||
52 | }; | 71 | }; |
53 | } | 72 | } |
diff --git a/user-profiles/core.nix b/user-profiles/core.nix index 6f473b1a..91685611 100644 --- a/user-profiles/core.nix +++ b/user-profiles/core.nix | |||
@@ -1,26 +1,8 @@ | |||
1 | { flake, userName, lib, customUtils, ... }: | 1 | { userName, ... }: |
2 | let | 2 | { |
3 | userProfileSet = customUtils.types.attrNameSet (lib.zipAttrs (lib.attrValues flake.nixosModules.userProfiles)); | 3 | users.users.${userName} = {}; # Just make sure the user is created |
4 | in { | ||
5 | options = { | ||
6 | users.users = lib.mkOption { | ||
7 | type = lib.types.attrsOf (lib.types.submodule { | ||
8 | options.profiles = lib.mkOption { | ||
9 | type = userProfileSet; | ||
10 | default = []; | ||
11 | description = '' | ||
12 | Set (list without duplicates) of ‘userProfiles’ enabled for this user | ||
13 | ''; | ||
14 | }; | ||
15 | }); | ||
16 | }; | ||
17 | }; | ||
18 | |||
19 | config = { | ||
20 | users.users.${userName} = {}; # Just make sure the user is created | ||
21 | 4 | ||
22 | home-manager.users.${userName} = { | 5 | home-manager.users.${userName} = { |
23 | manual.manpages.enable = true; | 6 | manual.manpages.enable = true; |
24 | }; | ||
25 | }; | 7 | }; |
26 | } | 8 | } |