depot/ops/vault/cfg/module-kv.nix

23 lines
456 B
Nix
Raw Normal View History

2022-03-14 23:34:33 +00:00
{ lib, config, ... }:
{
options = let
inherit (lib) mkOption types;
in {
my.secrets.apps = mkOption {
default = {};
type = with types; attrsOf attrs;
};
};
config = let
inherit (lib) nameValuePair mapAttrs';
in {
resource.vault_generic_secret = mapAttrs' (name: value: nameValuePair "apps_${name}" {
path = "kv/apps/${name}";
data_json = builtins.toJSON value;
}) config.my.secrets.apps;
};
}