meta: Avoid building rbw-bitw for all hosts

This commit is contained in:
kat witch 2021-09-04 19:34:09 +01:00
parent a23c94f597
commit b154039b72
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
5 changed files with 28 additions and 54 deletions

View file

@ -0,0 +1,5 @@
{ config, lib, ... }: with lib; {
options.kw.secrets.command = mkOption {
type = types.str;
};
}

View file

@ -1,4 +1,4 @@
{ config, lib, ... }:
{ config, lib, meta, ... }:
with lib;
@ -22,14 +22,12 @@ let
};
};
});
mcfg = meta.kw.secrets;
cfg = config.kw.secrets;
in
{
options.kw = {
secrets = {
command = mkOption {
type = types.str;
};
variables = mkOption {
type = types.attrsOf secretType;
default = { };
@ -48,7 +46,7 @@ in
deploy.tf.variables = mapAttrs'
(name: content:
nameValuePair name ({
value.shellCommand = "${cfg.command} ${content.path}" + optionalString (content.field != "") " -f ${content.field}";
value.shellCommand = "${mcfg.command} ${content.path}" + optionalString (content.field != "") " -f ${content.field}";
type = "string";
sensitive = true;
})

View file

@ -8,10 +8,4 @@
persistentRoot = "/var/lib/kat/secrets";
external = true;
};
kw.secrets.command =
let
bitw = pkgs.writeShellScriptBin "bitw" ''${pkgs.rbw-bitw}/bin/bitw -p gpg://${config.kw.secrets.repo.bitw.source} "$@"'';
in
"${bitw}/bin/bitw get";
}