nixfiles/lib/secrets-unsafe.nix

22 lines
436 B
Nix
Raw Permalink Normal View History

2024-05-01 05:48:50 +03:00
{
age,
writeShellScript,
system,
...
}:
{
readUnsafe = name: let
identityPath = ../secrets/unsafe.key;
2024-05-01 05:48:50 +03:00
path = ../secrets + "/UNSAFE.${name}.age";
drv = builtins.derivation {
2024-05-01 05:48:50 +03:00
system = system;
name = name;
src = path;
2024-05-01 05:48:50 +03:00
builder = writeShellScript "read-${name}.sh" ''
${age}/bin/age --decrypt --identity ${identityPath} $src > $out
'';
};
in builtins.readFile drv;
}