2018-01-13 12:41:08 +00:00
|
|
|
{ name, lib, ... }:
|
|
|
|
|
|
|
|
{
|
2024-10-19 05:13:33 +00:00
|
|
|
options = let
|
|
|
|
inherit (lib) literalExpression mkOption types;
|
|
|
|
in {
|
2018-01-13 12:41:08 +00:00
|
|
|
name = mkOption {
|
2024-10-22 08:49:13 +00:00
|
|
|
type = types.nonEmptyStr;
|
2024-10-19 05:13:33 +00:00
|
|
|
default = name;
|
2024-04-14 21:02:32 +00:00
|
|
|
description = ''
|
2018-01-13 12:41:08 +00:00
|
|
|
The name of the user account. If undefined, the name of the
|
|
|
|
attribute set will be used.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
description = mkOption {
|
2024-10-21 23:24:06 +00:00
|
|
|
type = types.nullOr types.nonEmptyStr;
|
|
|
|
default = null;
|
2018-01-13 12:41:08 +00:00
|
|
|
example = "Alice Q. User";
|
2024-04-14 21:02:32 +00:00
|
|
|
description = ''
|
2018-01-13 12:41:08 +00:00
|
|
|
A short description of the user account, typically the
|
|
|
|
user's full name.
|
2024-10-21 23:24:06 +00:00
|
|
|
|
|
|
|
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.
|
2018-01-13 12:41:08 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
uid = mkOption {
|
|
|
|
type = types.int;
|
2024-04-14 21:02:32 +00:00
|
|
|
description = "The user's UID.";
|
2018-01-13 12:41:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
gid = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 20;
|
2024-04-14 21:02:32 +00:00
|
|
|
description = "The user's primary group.";
|
2018-01-13 12:41:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
isHidden = mkOption {
|
|
|
|
type = types.bool;
|
2018-01-14 15:15:27 +00:00
|
|
|
default = true;
|
2024-04-14 21:02:32 +00:00
|
|
|
description = "Whether to make the user account hidden.";
|
2018-01-13 12:41:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# extraGroups = mkOption {
|
|
|
|
# type = types.listOf types.str;
|
|
|
|
# default = [];
|
|
|
|
# description = "The user's auxiliary groups.";
|
|
|
|
# };
|
|
|
|
|
|
|
|
home = mkOption {
|
2024-10-24 12:19:27 +00:00
|
|
|
type = types.nullOr types.path;
|
|
|
|
default = null;
|
|
|
|
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`.
|
|
|
|
'';
|
2018-01-13 12:41:08 +00:00
|
|
|
};
|
|
|
|
|
2019-02-23 16:29:57 +00:00
|
|
|
createHome = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2024-04-14 21:02:32 +00:00
|
|
|
description = "Create the home directory when creating the user.";
|
2019-02-23 16:29:57 +00:00
|
|
|
};
|
|
|
|
|
2018-01-13 12:41:08 +00:00
|
|
|
shell = mkOption {
|
|
|
|
type = types.either types.shellPackage types.path;
|
2024-10-26 00:35:34 +00:00
|
|
|
default = "/usr/bin/false";
|
2021-10-23 13:05:52 +00:00
|
|
|
example = literalExpression "pkgs.bashInteractive";
|
2024-04-14 21:02:32 +00:00
|
|
|
description = "The user's shell.";
|
2018-01-13 12:41:08 +00:00
|
|
|
};
|
2019-02-20 16:20:32 +00:00
|
|
|
|
|
|
|
packages = mkOption {
|
|
|
|
type = types.listOf types.package;
|
|
|
|
default = [];
|
2021-10-23 13:05:52 +00:00
|
|
|
example = literalExpression "[ pkgs.firefox pkgs.thunderbird ]";
|
2024-04-14 21:02:32 +00:00
|
|
|
description = ''
|
2019-02-20 16:20:32 +00:00
|
|
|
The set of packages that should be made availabe to the user.
|
2023-06-22 11:21:32 +00:00
|
|
|
This is in contrast to {option}`environment.systemPackages`,
|
2019-02-20 16:20:32 +00:00
|
|
|
which adds packages to all users.
|
|
|
|
'';
|
|
|
|
};
|
2018-01-13 12:41:08 +00:00
|
|
|
};
|
|
|
|
}
|