mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-22 00:04:20 +01:00
Add a little deploy script
Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
parent
fe61b3cc5e
commit
348b4e088e
26
flake.nix
26
flake.nix
|
@ -59,6 +59,32 @@
|
||||||
in
|
in
|
||||||
nixpkgs.lib.mapAttrs (n: v: makeJob v) self.nixngSystems;
|
nixpkgs.lib.mapAttrs (n: v: makeJob v) self.nixngSystems;
|
||||||
|
|
||||||
|
apps = forAllSystems (system:
|
||||||
|
let pkgs = pkgsForSystem system;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
terraform = {
|
||||||
|
type = "app";
|
||||||
|
program = toString (pkgs.writeShellScript "terraform" ''
|
||||||
|
export PATH="${pkgs.lib.makeBinPath (with pkgs; [ terraform bash coreutils jq nix git ])}"
|
||||||
|
_flake_metadata="$(nix flake metadata git+file://$PWD?rev="$(git rev-parse HEAD)" --json)"
|
||||||
|
export TF_VAR_flake_rev="$(echo "$_flake_metadata" | jq .locked.rev -r)"
|
||||||
|
export TF_VAR_flake_sha="$(echo "$_flake_metadata" | jq .locked.narHash -r)"
|
||||||
|
export TF_VAR_flake_ref="$(git name-rev --name-only HEAD)"
|
||||||
|
case "$1" in
|
||||||
|
"env")
|
||||||
|
shift 1
|
||||||
|
env
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
terraform "$@"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
'');
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
devShell = forAllSystems (system:
|
devShell = forAllSystems (system:
|
||||||
let pkgs = pkgsForSystem system;
|
let pkgs = pkgsForSystem system;
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
flake_rev = "a27a4c4e78928564383e165b3868aa4f63c451df"
|
|
||||||
flake_ref = "conduit-wip"
|
|
||||||
flake_host = "git+https://git.sr.ht/~magic_rb/cluster"
|
flake_host = "git+https://git.sr.ht/~magic_rb/cluster"
|
||||||
flake_host_alt = "git+https://git.sr.ht/~magic_rb/cluster"
|
flake_host_alt = "git+https://git.sr.ht/~magic_rb/cluster"
|
||||||
flake_sha = "sha256-7b/9W8mDnqQv0DfH6if0IVbMWR8iEvor7Ktth/WkX9M="
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue