Skip to content

Commit 2de9ba6

Browse files
committed
nixos: refer to real os name of the user
The name passed in via `environment.persistence.<root>.users.<name>` is expected to match `users.users.<name>`. However, that may not be the actual username of the user known to the OS if `users.users.<name>.name` is set to something else.
1 parent 7b1d382 commit 2de9ba6

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

nixos.nix

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ in
142142
config = outerConfig // config;
143143
name = outerName;
144144
usersOpts = true;
145-
user = name;
145+
user = users.${name}.name;
146146
group = users.${name}.group;
147147
homeDir = users.${name}.home;
148148
}
@@ -369,10 +369,8 @@ in
369369
dirPath = dir.home;
370370
home = null;
371371
mode = "0700";
372-
user = dir.user;
373-
group = users.${dir.user}.group;
374372
inherit defaultPerms;
375-
inherit (dir) persistentStoragePath enableDebugging;
373+
inherit (dir) user group persistentStoragePath enableDebugging;
376374
};
377375
in
378376
if dir.home != null then

0 commit comments

Comments
 (0)