diff options
| author | Michael Hoang <enzime@users.noreply.github.com> | 2024-10-22 10:24:06 +1100 |
|---|---|---|
| committer | Michael Hoang <enzime@users.noreply.github.com> | 2024-10-22 22:54:04 +1100 |
| commit | 11c777c7198f4cfcd55fe81646e503c58ceb9f4a (patch) | |
| tree | 35740edbc7a5559101a5eb583f55e9708026cf9e /modules/users | |
| parent | ac7932f9de36b8126abcb9d4966d5d95fcadd807 (diff) | |
users: change default `description` to `null`
Diffstat (limited to 'modules/users')
| -rw-r--r-- | modules/users/default.nix | 2 | ||||
| -rw-r--r-- | modules/users/user.nix | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/modules/users/default.nix b/modules/users/default.nix index 9f906b3..e9e3ac4 100644 --- a/modules/users/default.nix +++ b/modules/users/default.nix @@ -168,7 +168,7 @@ in else if [ -z "$u" ]; then echo "creating user ${v.name}..." >&2 - sysadminctl -addUser ${lib.escapeShellArgs [ v.name "-UID" v.uid "-GID" v.gid "-fullName" v.description "-home" v.home "-shell" (shellPath v.shell) ]} + sysadminctl -addUser ${lib.escapeShellArgs ([ v.name "-UID" v.uid "-GID" v.gid ] ++ (lib.optionals (v.description != null) [ "-fullName" v.description ]) ++ [ "-home" v.home "-shell" (shellPath v.shell) ])} dscl . -create ${dsclUser} IsHidden ${if v.isHidden then "1" else "0"} ${optionalString v.createHome "createhomedir -cu ${name}"} fi diff --git a/modules/users/user.nix b/modules/users/user.nix index 363c300..1a8e877 100644 --- a/modules/users/user.nix +++ b/modules/users/user.nix @@ -14,12 +14,18 @@ }; description = mkOption { - type = types.str; - default = ""; + type = types.nullOr types.nonEmptyStr; + default = null; example = "Alice Q. User"; description = '' A short description of the user account, typically the user's full name. + + This defaults to `null` which means, on creation, `sysadminctl` + will pick the description which is usually always {option}`name`. + + Using an empty name is not supported and breaks macOS like + making the user not appear in Directory Utility. ''; }; |
