depot/ops/vault/cfg/default.nix

26 lines
654 B
Nix
Raw Permalink Normal View History

2022-03-14 21:29:15 +00:00
{ pkgs, depotRoot, ... }@args:
let
terranix = import "${pkgs.terranix}/core/default.nix" {
inherit pkgs;
terranix_config = { imports = [ ./config.nix ]; };
2022-03-14 23:34:33 +00:00
strip_nulls = false;
extraArgs = args // {
lib = args.lib // {
mapToAttrs = pred: onWhat: builtins.listToAttrs (map pred onWhat);
};
};
2022-03-14 21:29:15 +00:00
};
config = (pkgs.formats.json { }).generate "config.tf.json" terranix.config;
terraform = pkgs.writeShellScript "terraform" ''
cd ${depotRoot}/ops/vault/cfg/tf
rm ./config.tf.json
ln -s ${config} config.tf.json
exec ${pkgs.terraform}/bin/terraform "$@"
'';
in {
inherit config terraform;
}