Skip to content

Commit 4d8a451

Browse files
authored
Merge pull request #1355 from toodeluna/fix/profile-name
fix: use correct username for profile
2 parents 2fb6b09 + 9ddb2e6 commit 4d8a451

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

modules/users/default.nix

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ let
1111
group = import ./group.nix;
1212
user = import ./user.nix;
1313

14-
toGID = v: { "${toString v.gid}" = v.name; };
15-
toUID = v: { "${toString v.uid}" = v.name; };
14+
toGID = n: v: { "${toString v.gid}" = n; };
15+
toUID = n: v: { "${toString v.uid}" = n; };
1616

1717
isCreated = list: name: elem name list;
1818
isDeleted = attrs: name: ! elem name (mapAttrsToList (n: v: v.name) attrs);
1919

20-
gids = mapAttrsToList (n: toGID) (filterAttrs (n: v: isCreated cfg.knownGroups v.name) cfg.groups);
21-
uids = mapAttrsToList (n: toUID) (filterAttrs (n: v: isCreated cfg.knownUsers v.name) cfg.users);
20+
gids = mapAttrsToList toGID (filterAttrs (n: v: isCreated cfg.knownGroups v.name) cfg.groups);
21+
uids = mapAttrsToList toUID (filterAttrs (n: v: isCreated cfg.knownUsers v.name) cfg.users);
2222

2323
createdGroups = mapAttrsToList (n: v: cfg.groups."${v}") cfg.gids;
2424
createdUsers = mapAttrsToList (n: v: cfg.users."${v}") cfg.uids;
@@ -112,14 +112,14 @@ in
112112
in
113113
!user.ignoreShellProgramCheck -> (s == shell || (shell == "bash" && s == "bash-interactive")) -> (config.programs.${shell}.enable == true);
114114
message = ''
115-
users.users.${user.name}.shell is set to ${shell}, but
115+
users.users.${name}.shell is set to ${shell}, but
116116
programs.${shell}.enable is not true. This will cause the ${shell}
117117
shell to lack the basic Nix directories in its PATH and might make
118118
logging in as that user impossible. You can fix it with:
119119
programs.${shell}.enable = true;
120120
121121
If you know what you're doing and you are fine with the behavior,
122-
set users.users.${user.name}.ignoreShellProgramCheck = true;
122+
set users.users.${name}.ignoreShellProgramCheck = true;
123123
instead.
124124
'';
125125
}) [
@@ -331,7 +331,7 @@ in
331331
environment.systemPackages = systemShells;
332332

333333
environment.etc = mapAttrs' (name: { packages, ... }: {
334-
name = "profiles/per-user/${name}";
334+
name = "profiles/per-user/${cfg.users.${name}.name}";
335335
value.source = pkgs.buildEnv {
336336
name = "user-environment";
337337
paths = packages;

0 commit comments

Comments
 (0)