Add a little deploy script

Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
Magic_RB 2022-10-11 07:56:46 +02:00
parent fe61b3cc5e
commit 348b4e088e
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E
2 changed files with 26 additions and 3 deletions

View file

@ -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;

View file

@ -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="