1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00
nix-darwin/modules/users/user.nix

93 lines
2.6 KiB
Nix

{ name, lib, ... }:
{
options = let
inherit (lib) literalExpression mkOption types;
in {
name = mkOption {
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.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.
'';
};
uid = mkOption {
type = types.int;
description = "The user's UID.";
};
gid = mkOption {
type = types.int;
default = 20;
description = "The user's primary group.";
};
isHidden = mkOption {
type = types.bool;
default = true;
description = "Whether to make the user account hidden.";
};
# extraGroups = mkOption {
# type = types.listOf types.str;
# default = [];
# description = "The user's auxiliary groups.";
# };
home = mkOption {
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`.
'';
};
createHome = mkOption {
type = types.bool;
default = false;
description = "Create the home directory when creating the user.";
};
shell = mkOption {
type = types.either types.shellPackage types.path;
default = "/usr/bin/false";
example = literalExpression "pkgs.bashInteractive";
description = "The user's shell.";
};
packages = mkOption {
type = types.listOf types.package;
default = [];
example = literalExpression "[ pkgs.firefox pkgs.thunderbird ]";
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.
'';
};
};
}