2024-11-25 21:04:18 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit (lib) types mkOption;
|
|
|
|
createTmpfilesEntries = entries: builtins.attrValues (builtins.mapAttrs (dest: path: "L+ %h/${dest} - - - - ${path}") entries);
|
|
|
|
cfg = config.alqueva.users;
|
|
|
|
in {
|
|
|
|
options.alqueva.users = mkOption {
|
|
|
|
description = "Users to have on the system.";
|
|
|
|
default = {};
|
|
|
|
type = types.attrsOf (types.submodule {
|
|
|
|
options = {
|
|
|
|
tmpfiles = mkOption {
|
|
|
|
description = "tmpfiles";
|
|
|
|
type = types.attrsOf types.path;
|
|
|
|
default = {};
|
|
|
|
};
|
|
|
|
packages = mkOption {
|
|
|
|
type = types.listOf types.package;
|
|
|
|
default = [];
|
|
|
|
description = "Packages installed to the the defined user.";
|
|
|
|
};
|
|
|
|
groups = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
|
|
|
description = "Groups to add the defined user to.";
|
|
|
|
};
|
2024-12-14 11:14:51 +00:00
|
|
|
shell = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = config.programs.bash.package;
|
|
|
|
description = "Shell the user wants to use.";
|
|
|
|
};
|
2024-11-25 21:04:18 +00:00
|
|
|
};
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
users.users =
|
|
|
|
builtins.mapAttrs (user: ucfg: {
|
|
|
|
description = user;
|
|
|
|
isNormalUser = true;
|
|
|
|
extraGroups = ucfg.groups;
|
|
|
|
inherit (ucfg) packages;
|
2024-12-14 11:14:51 +00:00
|
|
|
shell = ucfg.shell;
|
2024-12-10 23:03:51 +00:00
|
|
|
initialPassword = "password";
|
2024-11-25 21:04:18 +00:00
|
|
|
})
|
|
|
|
cfg;
|
|
|
|
|
|
|
|
systemd.user.tmpfiles.users =
|
|
|
|
builtins.mapAttrs (_: ucfg: {
|
|
|
|
rules = createTmpfilesEntries ucfg.tmpfiles;
|
|
|
|
})
|
|
|
|
cfg;
|
|
|
|
};
|
|
|
|
}
|