diff options
| author | seth <[email protected]> | 2024-10-08 11:09:41 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2024-10-08 11:09:41 -0400 |
| commit | c20ed35827d4abed986c3a8340cabfd2aad751f3 (patch) | |
| tree | 0f71d748f83d333ca94622075de298ca8fa7356b | |
| parent | 3257035b425d544d2d96dd9f3348d3cd337b2ee9 (diff) | |
terranix: add apply script
| -rw-r--r-- | ext/terranix/default.nix | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/ext/terranix/default.nix b/ext/terranix/default.nix index 44ede51..1af9002 100644 --- a/ext/terranix/default.nix +++ b/ext/terranix/default.nix @@ -1,24 +1,44 @@ { inputs, ... }: { perSystem = - { pkgs, system, ... }: { - packages = { - opentofu = pkgs.opentofu.withPlugins (plugins: [ - plugins.cloudflare - plugins.tailscale - ]); + lib, + pkgs, + self', + system, + ... + }: + let + inherit (self'.packages) opentofu; - terranix = inputs.terranix.lib.terranixConfiguration { - inherit system; - modules = [ - ./cloudflare - ./tailscale - ./cloud.nix - ./vars.nix - ./versions.nix - ]; + terranix = inputs.terranix.lib.terranixConfiguration { + inherit system; + modules = [ + ./cloudflare + ./tailscale + ./cloud.nix + ./vars.nix + ./versions.nix + ]; + }; + in + { + apps = { + apply-tf = { + type = "app"; + program = lib.getExe ( + pkgs.writeShellScriptBin "apply" '' + cp --force ${terranix} config.tf.json \ + && ${lib.getExe opentofu} init \ + && ${lib.getExe opentofu} apply + '' + ); }; }; + + packages.opentofu = pkgs.opentofu.withPlugins (plugins: [ + plugins.cloudflare + plugins.tailscale + ]); }; } |
