feat: renamed computers to hosts
This commit is contained in:
parent
f6af310a18
commit
b03c70b486
34 changed files with 5 additions and 6 deletions
51
hosts/shared/users.nix
Normal file
51
hosts/shared/users.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
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.";
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
config = {
|
||||
users.users =
|
||||
builtins.mapAttrs (user: ucfg: {
|
||||
description = user;
|
||||
isNormalUser = true;
|
||||
extraGroups = ucfg.groups;
|
||||
inherit (ucfg) packages;
|
||||
shell = config.programs.xonsh.package;
|
||||
})
|
||||
cfg;
|
||||
|
||||
systemd.user.tmpfiles.users =
|
||||
builtins.mapAttrs (_: ucfg: {
|
||||
rules = createTmpfilesEntries ucfg.tmpfiles;
|
||||
})
|
||||
cfg;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue