forked from the-distro/infra
flake: replace tf wrappers with a single '.#tf' command
This commit is contained in:
parent
2e9483936e
commit
dd72904bf1
30
flake.nix
30
flake.nix
|
@ -41,38 +41,16 @@
|
|||
in
|
||||
{
|
||||
apps.${system} = {
|
||||
apply = {
|
||||
tf = {
|
||||
type = "app";
|
||||
program = toString (pkgs.writers.writeBash "apply" ''
|
||||
set -eo pipefail
|
||||
rm -f config.tf.json
|
||||
cp ${terraformCfg} config.tf.json
|
||||
${lib.getExe terraform} init
|
||||
${lib.getExe terraform} apply
|
||||
'');
|
||||
};
|
||||
plan = {
|
||||
type = "app";
|
||||
program = toString (pkgs.writers.writeBash "plan" ''
|
||||
set -eo pipefail
|
||||
rm -f config.tf.json
|
||||
cp ${terraformCfg} config.tf.json
|
||||
${lib.getExe terraform} init
|
||||
${lib.getExe terraform} plan
|
||||
'');
|
||||
};
|
||||
# nix run ".#destroy"
|
||||
destroy = {
|
||||
type = "app";
|
||||
program = toString (pkgs.writers.writeBash "destroy" ''
|
||||
program = toString (pkgs.writers.writeBash "tf" ''
|
||||
set -eo pipefail
|
||||
ln -snf ${terraformCfg} config.tf.json
|
||||
${lib.getExe terraform} init
|
||||
${lib.getExe terraform} destroy
|
||||
exec ${lib.getExe terraform} "$@"
|
||||
'');
|
||||
};
|
||||
|
||||
default = self.apps.${system}.apply;
|
||||
default = self.apps.${system}.tf;
|
||||
};
|
||||
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
|
|
Loading…
Reference in a new issue