refactor!(tmpfiles): expand power upon tmpfiles by deabstracting
This returns tmpfiles to its original form. Turns out that making something too simple gives it less power.
This commit is contained in:
parent
f4770f1908
commit
035fb24038
20 changed files with 74 additions and 72 deletions
|
@ -3,34 +3,34 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) types mkOption;
|
||||
createTmpfilesEntries = entries: builtins.attrValues (builtins.mapAttrs (dest: path: "L+ %h/${dest} - - - - ${path}") entries);
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) attrsOf listOf submodule str package;
|
||||
users = config.alqueva.users;
|
||||
in {
|
||||
options.alqueva.users = mkOption {
|
||||
type = types.attrsOf (types.submodule {
|
||||
type = attrsOf (submodule {
|
||||
options = {
|
||||
tmpfiles = mkOption {
|
||||
description = "tmpfiles";
|
||||
type = types.attrsOf types.path;
|
||||
default = {};
|
||||
type = listOf str;
|
||||
default = [];
|
||||
};
|
||||
packages = mkOption {
|
||||
type = types.listOf types.package;
|
||||
type = listOf package;
|
||||
default = [];
|
||||
description = "Packages installed to the the defined user.";
|
||||
};
|
||||
groups = mkOption {
|
||||
type = types.listOf types.str;
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Groups to add the defined user to.";
|
||||
};
|
||||
shell = mkOption {
|
||||
type = types.package;
|
||||
type = package;
|
||||
default = config.programs.bash.package;
|
||||
description = "Shell the user wants to use.";
|
||||
};
|
||||
enable = (lib.mkEnableOption "this user.") // {default = true;};
|
||||
enable = (mkEnableOption "this user.") // {default = true;};
|
||||
};
|
||||
});
|
||||
description = "Users to have on the system.";
|
||||
|
@ -52,7 +52,7 @@ in {
|
|||
|
||||
systemd.user.tmpfiles.users =
|
||||
builtins.mapAttrs (_: uc: {
|
||||
rules = createTmpfilesEntries uc.tmpfiles;
|
||||
rules = uc.tmpfiles;
|
||||
})
|
||||
enabledUsers;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue