Add secrets support to dev VMs

This commit is contained in:
2022-02-22 01:30:27 +00:00
parent 8c61cea30d
commit fcad909111
3 changed files with 16 additions and 4 deletions

View File

@@ -62,6 +62,7 @@ in
virtualisation = {
diskImage = dummyOption;
forwardPorts = dummyOption;
sharedDirectories = dummyOption;
};
};

View File

@@ -1,6 +1,7 @@
{ lib, config, secretsPath, ... }:
let
inherit (builtins) mapAttrs;
inherit (lib) mkMerge mkIf;
inherit (lib.my) mkOpt';
cfg = config.my.secrets;
@@ -11,7 +12,14 @@ in
files = mkOpt' (attrsOf unspecified) { } "Secrets to decrypt with agenix.";
};
config.age.secrets = mapAttrs (f: opts: {
file = "${secretsPath}/${f}.age";
} // opts) cfg.files;
config = mkMerge [
{
age.secrets = mapAttrs (f: opts: {
file = "${secretsPath}/${f}.age";
} // opts) cfg.files;
}
(mkIf config.my.build.isDevVM {
age.identityPaths = [ "/tmp/xchg/dev.key" ];
})
];
}