mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 16:39:07 +01:00
sops: Add assertions to validate secret existence at eval time
This commit is contained in:
parent
1a78e2b1f0
commit
653a6f310b
1 changed files with 8 additions and 0 deletions
|
|
@ -36,5 +36,13 @@ in
|
|||
age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/id_ed25519" ];
|
||||
defaultSopsFile = cfg.secretsFile;
|
||||
};
|
||||
|
||||
assertions =
|
||||
config.sops.secrets
|
||||
|> lib.attrNames
|
||||
|> lib.map (secretPath: {
|
||||
assertion = cfg.secrets |> lib.hasAttrByPath (secretPath |> lib.splitString "/");
|
||||
message = "Sops secret `${secretPath}` must be defined in secrets.json";
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue