krebs.permown: listOf -> attrsOf

This commit is contained in:
tv 2019-04-18 01:23:12 +02:00
parent ffd36f5554
commit 520c9ef692

View File

@ -2,8 +2,8 @@ with import <stockholm/lib>;
{ config, pkgs, ... }: {
options.krebs.permown = mkOption {
default = [];
type = types.listOf (types.submodule {
default = {};
type = types.attrsOf (types.submodule ({ config, ... }: {
options = {
directory-mode = mkOption {
default = "=rwx";
@ -22,6 +22,7 @@ with import <stockholm/lib>;
type = types.username;
};
path = mkOption {
default = config._module.args.name;
type = types.absolute-pathname;
};
umask = mkOption {
@ -29,10 +30,14 @@ with import <stockholm/lib>;
type = types.file-mode;
};
};
});
}));
};
config.systemd.services = genAttrs' config.krebs.permown (plan: {
config = let
plans = attrValues config.krebs.permown;
in mkIf (plans != []) {
systemd.services = genAttrs' plans (plan: {
name = "permown.${replaceStrings ["/"] ["_"] plan.path}";
value = {
environment = {
@ -71,4 +76,6 @@ with import <stockholm/lib>;
};
});
};
}