diff options
| author | Michael Hoang <enzime@users.noreply.github.com> | 2024-10-28 10:30:02 +1100 |
|---|---|---|
| committer | Michael Hoang <enzime@users.noreply.github.com> | 2024-10-28 11:05:35 +1100 |
| commit | f380194f3dac82e63dc72db160490dcb58208534 (patch) | |
| tree | 80524f0d904ac3c3152fe1efb5cb4044a3d293f1 /modules/users | |
| parent | c908607e8a8ac1aaa0db60955800be4b02e500cc (diff) | |
users: create users with home directory `/var/empty` by default
Diffstat (limited to 'modules/users')
| -rw-r--r-- | modules/users/default.nix | 2 | ||||
| -rw-r--r-- | modules/users/user.nix | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/modules/users/default.nix b/modules/users/default.nix index 58156d2..a945fb4 100644 --- a/modules/users/default.nix +++ b/modules/users/default.nix @@ -260,7 +260,7 @@ in "-UID" v.uid "-GID" v.gid ] ++ (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 # We need to check as `sysadminctl -addUser` still exits with exit code 0 when there's an error diff --git a/modules/users/user.nix b/modules/users/user.nix index 72ae07b..9689e05 100644 --- a/modules/users/user.nix +++ b/modules/users/user.nix @@ -58,11 +58,9 @@ description = '' The user's home directory. This defaults to `null`. - When this is set to `null`, the value is managed by macOS instead of - `nix-darwin`. This means if the user has not been created yet, - `sysadminctl` will be called without the `-home` flag which means the - user will have a default home directory of `/Users/<name>` which will - be created by `sysadminctl`. + When this is set to `null`, if the user has not been created yet, + they will be created with the home directory `/var/empty` to match + the old default. ''; }; |
