mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
users: create users with home directory /var/empty
by default
This commit is contained in:
parent
c908607e8a
commit
f380194f3d
3 changed files with 5 additions and 7 deletions
|
@ -260,7 +260,7 @@ in
|
||||||
"-UID" v.uid
|
"-UID" v.uid
|
||||||
"-GID" v.gid ]
|
"-GID" v.gid ]
|
||||||
++ (lib.optionals (v.description != null) [ "-fullName" v.description ])
|
++ (lib.optionals (v.description != null) [ "-fullName" v.description ])
|
||||||
++ (lib.optionals (v.home != null) [ "-home" v.home ])
|
++ [ "-home" (if v.home != null then v.home else "/var/empty") ]
|
||||||
++ [ "-shell" (if v.shell != null then shellPath v.shell else "/usr/bin/false") ])} 2> /dev/null
|
++ [ "-shell" (if v.shell != null then shellPath v.shell else "/usr/bin/false") ])} 2> /dev/null
|
||||||
|
|
||||||
# We need to check as `sysadminctl -addUser` still exits with exit code 0 when there's an error
|
# We need to check as `sysadminctl -addUser` still exits with exit code 0 when there's an error
|
||||||
|
|
|
@ -58,11 +58,9 @@
|
||||||
description = ''
|
description = ''
|
||||||
The user's home directory. This defaults to `null`.
|
The user's home directory. This defaults to `null`.
|
||||||
|
|
||||||
When this is set to `null`, the value is managed by macOS instead of
|
When this is set to `null`, if the user has not been created yet,
|
||||||
`nix-darwin`. This means if the user has not been created yet,
|
they will be created with the home directory `/var/empty` to match
|
||||||
`sysadminctl` will be called without the `-home` flag which means the
|
the old default.
|
||||||
user will have a default home directory of `/Users/<name>` which will
|
|
||||||
be created by `sysadminctl`.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
grep "sysadminctl -addUser ${lib.escapeShellArgs [ "foo" "-UID" 42000 "-GID" 42000 "-fullName" "Foo user" "-home" "/Users/foo" "-shell" "/run/current-system/sw/bin/bash" ]}" ${config.out}/activate
|
grep "sysadminctl -addUser ${lib.escapeShellArgs [ "foo" "-UID" 42000 "-GID" 42000 "-fullName" "Foo user" "-home" "/Users/foo" "-shell" "/run/current-system/sw/bin/bash" ]}" ${config.out}/activate
|
||||||
grep "createhomedir -cu ${lib.escapeShellArg "foo"}" ${config.out}/activate
|
grep "createhomedir -cu ${lib.escapeShellArg "foo"}" ${config.out}/activate
|
||||||
grep "sysadminctl -addUser ${lib.escapeShellArgs [ "created.user" "-UID" 42001 ]} .* ${lib.escapeShellArgs [ "-shell" "/usr/bin/false" ] }" ${config.out}/activate
|
grep "sysadminctl -addUser ${lib.escapeShellArgs [ "created.user" "-UID" 42001 ]} .* ${lib.escapeShellArgs [ "-shell" "/usr/bin/false" ] }" ${config.out}/activate
|
||||||
(! grep "sysadminctl -addUser ${lib.escapeShellArg "created.user"} .* -home" ${config.out}/activate)
|
grep "sysadminctl -addUser ${lib.escapeShellArg "created.user"} .* ${lib.escapeShellArgs [ "-home" "/var/empty" ]}" ${config.out}/activate
|
||||||
(! grep "dscl . -delete ${lib.escapeShellArg "/Users/created.user"}" ${config.out}/activate)
|
(! grep "dscl . -delete ${lib.escapeShellArg "/Users/created.user"}" ${config.out}/activate)
|
||||||
(! grep "dscl . -delete ${lib.escapeShellArg "/Groups/created.user"}" ${config.out}/activate)
|
(! grep "dscl . -delete ${lib.escapeShellArg "/Groups/created.user"}" ${config.out}/activate)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue