vars: fix bug when computing taarget path for sops

This commit is contained in:
DavHau
2024-07-29 18:17:43 +07:00
parent c782c6b266
commit 71df351217
2 changed files with 4 additions and 4 deletions

View File

@@ -20,7 +20,7 @@ in
# Before we generate a secret we cannot know the path yet, so we need to set it to an empty string # Before we generate a secret we cannot know the path yet, so we need to set it to an empty string
fileModule = file: { fileModule = file: {
path = lib.mkIf file.config.secret ( path = lib.mkIf file.config.secret (
config.sops.secrets.${"vars-${config.clan.core.machineName}-${file.config.generatorName}-${file.config.name}"}.path config.sops.secrets.${"${config.clan.core.machineName}/${file.config.generatorName}/${file.config.name}"}.path
or "/no-such-path" or "/no-such-path"
); );
}; };
@@ -31,10 +31,9 @@ in
config.sops = lib.mkIf (config.clan.core.vars.settings.secretStore == "sops") { config.sops = lib.mkIf (config.clan.core.vars.settings.secretStore == "sops") {
secrets = lib.listToAttrs ( secrets = lib.listToAttrs (
flip map vars (secret: { flip map vars (secret: {
name = secret.name; name = secret.id;
value = { value = {
sopsFile = sopsFile = config.clan.core.clanDir + "/sops/vars/${secret.id}/secret";
config.clan.core.clanDir + "/sops/vars/${secret.machine}/${secret.generator}/${secret.name}/secret";
format = "binary"; format = "binary";
}; };
}) })

View File

@@ -22,6 +22,7 @@ rec {
machine = machine_name; machine = machine_name;
generator = generator_name; generator = generator_name;
name = secret_name; name = secret_name;
id = "${machine_name}/${generator_name}/${secret_name}";
}) })
) )
); );