Clean up the users.nix file

This commit is contained in:
Manuel Thalmann 2024-08-23 18:51:54 +02:00
parent 6ae1a4a688
commit c2b83d666a

View file

@ -7,58 +7,66 @@
cfg = config.valhalla; cfg = config.valhalla;
capitalize = (import ../text.nix { inherit lib; }).capitalize; capitalize = (import ../text.nix { inherit lib; }).capitalize;
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;
};
};
});
in { in {
options = { options = {
valhalla = { valhalla = {
users = mkOption { users = mkOption {
type = types.attrsOf (types.submodule ( type = types.attrsOf userType;
{ ... }: {
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 = [];
};
};
}));
description = "The users to create on the machine."; description = "The users to create on the machine.";
default = {}; default = {};
}; };
linux.users = mkOption { linux.users = mkOption {
type = types.attrsOf (types.submodule { type = types.attrsOf linuxUserType;
options = {
defaultShell = mkOption {
type = types.nullOr types.str;
description = "The default shell of the user.";
default = null;
};
};
});
}; };
windows.users = mkOption { windows.users = mkOption {
type = types.attrsOf (types.submodule { type = types.attrsOf winUserType;
options = {
microsoftAccount = mkOption {
type = types.bool;
description = "A value indicating whether this user is a Microsoft Account.";
default = false;
};
};
});
}; };
}; };
}; };