2024-08-24 01:25:28 +00:00
|
|
|
{ lib, ... }:
|
2024-07-19 22:45:20 +00:00
|
|
|
let
|
|
|
|
inherit (lib)
|
|
|
|
mkOption
|
|
|
|
types
|
|
|
|
;
|
|
|
|
|
2024-08-08 13:28:29 +00:00
|
|
|
capitalize = (import ../text.nix { inherit lib; }).capitalize;
|
2024-08-23 16:51:54 +00:00
|
|
|
|
|
|
|
userType = types.submodule (
|
|
|
|
{ ... } : {
|
|
|
|
options = {
|
|
|
|
displayName = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
description = "The human-readable name of the user.";
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
|
|
|
|
mailAddress = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
description = "The mail address of the user.";
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
|
|
|
|
groups = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
description = "The additional groups of the user.";
|
|
|
|
default = [];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
linuxUserType = types.submodule (
|
|
|
|
{ ... }: {
|
|
|
|
options = {
|
|
|
|
defaultShell = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
description = "The default shell of the user.";
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
winUserType = types.submodule (
|
|
|
|
{ ... }: {
|
|
|
|
options = {
|
|
|
|
microsoftAccount = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
description = "A value indicating whether this user is a Microsoft Account.";
|
|
|
|
default = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
2024-07-19 22:45:20 +00:00
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
valhalla = {
|
|
|
|
users = mkOption {
|
2024-08-23 16:51:54 +00:00
|
|
|
type = types.attrsOf userType;
|
2024-07-19 22:45:20 +00:00
|
|
|
description = "The users to create on the machine.";
|
|
|
|
default = {};
|
|
|
|
};
|
2024-08-08 13:28:29 +00:00
|
|
|
|
2024-08-23 16:28:20 +00:00
|
|
|
linux.users = mkOption {
|
2024-08-23 16:51:54 +00:00
|
|
|
type = types.attrsOf linuxUserType;
|
2024-08-23 16:28:20 +00:00
|
|
|
};
|
|
|
|
|
2024-08-24 01:25:28 +00:00
|
|
|
windows = mkOption {
|
|
|
|
type = types.submoduleWith {
|
|
|
|
modules = [
|
|
|
|
({ config, options, ... }: {
|
|
|
|
options = {
|
|
|
|
users = mkOption {
|
|
|
|
type = types.attrsOf winUserType;
|
|
|
|
};
|
|
|
|
|
|
|
|
winUsers = mkOption {
|
|
|
|
type = options.users.type;
|
|
|
|
default = (lib.attrsets.concatMapAttrs (
|
|
|
|
name: options: {
|
2024-09-03 18:32:01 +00:00
|
|
|
${capitalize name} = options;
|
2024-08-24 01:25:28 +00:00
|
|
|
}) config.users);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
|
|
|
};
|
2024-08-18 22:54:13 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-07-19 22:45:20 +00:00
|
|
|
}
|