dotfiles/terranix/lib/terraform-module.nix
magic_rb aff0158ef7
Reformat the whole flake using alejandra
Signed-off-by: magic_rb <magic_rb@redalder.org>
2024-03-02 22:17:03 +01:00

33 lines
580 B
Nix

{
tflib,
pkgs,
config,
}: {
name,
source,
...
} @ args:
{
source = let
module =
(tflib.mkTerranixConfiguration {
inherit pkgs;
modules = [
source
{
_file = "terraform-module.nix";
_module.args = builtins.removeAttrs config._module.args ["pkgs" "tflib"];
}
];
})
.config
.build
.json;
in
pkgs.runCommandNoCC "${name}-module" {} ''
mkdir -p $out/
ln -s ${module} $out/main.tf.json
'';
}
// builtins.removeAttrs args ["name" "source"]