modules/security: fix types

This commit is contained in:
Dmitriy Pleshevskiy 2024-09-29 15:21:11 +03:00
parent fe3043c6a4
commit e813ce3c9a
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2

View file

@ -9,7 +9,7 @@ in
type = types.listOf (types.submodule {
options = {
commands = mkOption {
type = listOf (types.either types.str types.package);
type = with types; listOf (either str package);
};
groups = mkOption {
type = types.listOf types.str;
@ -21,15 +21,15 @@ in
};
};
config = cfg.nopasswd != [ ] {
config = lib.mkIf (cfg.nopasswd != [ ]) {
security.sudo.extraRules = lib.flip map cfg.nopasswd (rule: {
inherit (rule) groups;
commands = lib.flip map rule.commands (cmd: [
commands = lib.flip map rule.commands (cmd:
{
command = "${cmd}";
options = [ "NOPASSWD" ];
}
]);
);
});
};