diff options
| author | Mike Vink <59492084+ivi-vink@users.noreply.github.com> | 2025-01-16 22:22:34 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-16 22:22:34 +0100 |
| commit | 8e7bd91f353caacc0bc4105f573eb3e17f09e03a (patch) | |
| tree | c5059edcbebd9644290cad7c653c49a36d593021 /modules/users/user.nix | |
| parent | 6bd39d420578aacf7c0bab7de3e7027b952115ae (diff) | |
| parent | bd921223ba7cdac346477d7ea5204d6f4736fcc6 (diff) | |
Diffstat (limited to 'modules/users/user.nix')
| -rw-r--r-- | modules/users/user.nix | 75 |
1 files changed, 50 insertions, 25 deletions
diff --git a/modules/users/user.nix b/modules/users/user.nix index 60592fc..5256ac3 100644 --- a/modules/users/user.nix +++ b/modules/users/user.nix @@ -1,42 +1,49 @@ { name, lib, ... }: -with lib; - { - options = { + options = let + inherit (lib) literalExpression mkOption types; + in { name = mkOption { - type = types.str; - description = lib.mdDoc '' + type = types.nonEmptyStr; + default = name; + description = '' The name of the user account. If undefined, the name of the attribute set will be used. ''; }; description = mkOption { - type = types.str; - default = ""; + type = types.nullOr types.nonEmptyStr; + default = null; example = "Alice Q. User"; - description = lib.mdDoc '' + 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. ''; }; uid = mkOption { type = types.int; - description = lib.mdDoc "The user's UID."; + description = "The user's UID."; }; gid = mkOption { type = types.int; default = 20; - description = lib.mdDoc "The user's primary group."; + description = "The user's primary group."; }; isHidden = mkOption { type = types.bool; default = true; - description = lib.mdDoc "Whether to make the user account hidden."; + description = "Whether to make the user account hidden."; }; # extraGroups = mkOption { @@ -46,39 +53,57 @@ with lib; # }; home = mkOption { - type = types.path; - default = "/var/empty"; - description = lib.mdDoc "The user's home directory."; + type = types.nullOr types.path; + default = null; + description = '' + The user's home directory. This defaults to `null`. + + 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. + ''; }; createHome = mkOption { type = types.bool; default = false; - description = lib.mdDoc "Create the home directory when creating the user."; + description = "Create the home directory when creating the user."; }; shell = mkOption { - type = types.either types.shellPackage types.path; - default = "/sbin/nologin"; + type = types.nullOr (types.either types.shellPackage types.path); + default = null; example = literalExpression "pkgs.bashInteractive"; - description = lib.mdDoc "The user's shell."; + description = '' + The user's shell. This defaults to `null`. + + When this is set to `null`, if the user has not been created yet, + they will be created with the shell `/usr/bin/false` to prevent + interactive login. If the user already exists, the value is + considered managed by macOS and `nix-darwin` will not change it. + ''; + }; + + ignoreShellProgramCheck = mkOption { + type = types.bool; + default = false; + description = '' + By default, nix-darwin will check that programs.SHELL.enable is set to + true if the user has a custom shell specified. If that behavior isn't + required and there are custom overrides in place to make sure that the + shell is functional, set this to true. + ''; }; packages = mkOption { type = types.listOf types.package; default = []; example = literalExpression "[ pkgs.firefox pkgs.thunderbird ]"; - description = lib.mdDoc '' + description = '' The set of packages that should be made availabe to the user. This is in contrast to {option}`environment.systemPackages`, which adds packages to all users. ''; }; }; - - config = { - - name = mkDefault name; - - }; } |
