vars: move owner/group to a sops namespace

we want to allow users to use this feature but do not want to use this
option in our own module because it's not supported by password store.
This commit is contained in:
Jörg Thalheim
2024-10-30 12:15:04 +01:00
parent 532a3d1009
commit 0842b05687
3 changed files with 24 additions and 10 deletions

View File

@@ -67,7 +67,17 @@ in
''; '';
type = attrsOf ( type = attrsOf (
submodule (file: { submodule (file: {
imports = [ config.settings.fileModule ]; imports = [
config.settings.fileModule
(lib.mkRenamedOptionModule [ "owner" ] [
"sops"
"owner"
])
(lib.mkRenamedOptionModule [ "group" ] [
"sops"
"group"
])
];
options = options { options = options {
name = { name = {
type = lib.types.str; type = lib.types.str;
@@ -119,14 +129,18 @@ in
''; '';
type = str; type = str;
}; };
owner = {
description = "The user name or id that will own the secret file. This option is currently only implemented for sops"; sops = {
default = "root"; owner = {
}; description = "The user name or id that will own the secret file. This option is currently only implemented for sops";
group = { default = "root";
description = "The group name or id that will own the secret file. This option is currently only implemented for sops"; };
default = "root"; group = {
description = "The group name or id that will own the secret file. This option is currently only implemented for sops";
default = "root";
};
}; };
value = value =
{ {
description = '' description = ''

View File

@@ -40,7 +40,7 @@ in
flip map vars (secret: { flip map vars (secret: {
name = "vars/${secret.generator}/${secret.name}"; name = "vars/${secret.generator}/${secret.name}";
value = { value = {
inherit (secret) owner group; inherit (secret.sops) owner group;
sopsFile = secretPath secret; sopsFile = secretPath secret;
format = "binary"; format = "binary";
}; };

View File

@@ -25,7 +25,7 @@ in
name = fname; name = fname;
generator = gen_name; generator = gen_name;
inherit (generator) share; inherit (generator) share;
inherit (file) owner group; inherit (file) sops;
} }
) )
) )