From ef62e6cc67cdd144b00dd857c2b2eb09846ab831 Mon Sep 17 00:00:00 2001 From: Magic_RB Date: Mon, 19 Jun 2023 00:41:49 +0200 Subject: [PATCH] Unhardcode empty flake_ref and friends Signed-off-by: Magic_RB --- terranix/containers/email/default.nix | 11 +++----- terranix/containers/gitea/default.nix | 11 +++----- .../containers/home-assistant/default.nix | 11 +++----- terranix/containers/hydra/default.nix | 11 +++----- .../containers/ingress-blowhole/default.nix | 11 +++----- .../containers/ingress-toothpick/default.nix | 11 +++----- terranix/containers/matrix/default.nix | 27 ++++++++----------- terranix/containers/syncthing/default.nix | 11 +++----- 8 files changed, 32 insertions(+), 72 deletions(-) diff --git a/terranix/containers/email/default.nix b/terranix/containers/email/default.nix index 8d26b1b..de30427 100644 --- a/terranix/containers/email/default.nix +++ b/terranix/containers/email/default.nix @@ -1,13 +1,8 @@ -{ elib, ... }: +{ elib, vars, ... }: let inherit (elib) nfsVolume nomadJob; - - flake_host = ""; - flake_rev = ""; - flake_ref = ""; - flake_sha = ""; in { resource."vault_policy"."dovecot-policy" = nfsVolume { @@ -47,8 +42,8 @@ in resource."nomad_job"."email" = { jobspec = ./job.hcl; vars = { - flake_ref = "${flake_host}?rev=${flake_rev}&ref=${flake_ref}"; - flake_sha = flake_sha; + flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}"; + flake_sha = vars.flake_sha; }; }; } diff --git a/terranix/containers/gitea/default.nix b/terranix/containers/gitea/default.nix index a6ec256..1a81a75 100644 --- a/terranix/containers/gitea/default.nix +++ b/terranix/containers/gitea/default.nix @@ -1,13 +1,8 @@ -{ elib, ... }: +{ elib, vars, ... }: let inherit (elib) nfsVolume nomadJob; - - flake_host = ""; - flake_rev = ""; - flake_ref = ""; - flake_sha = ""; in { resource."nomad_volume"."gitea-db" = nfsVolume { @@ -39,8 +34,8 @@ in jobspec = ./job.hcl; vars = { - flake_ref = "${flake_host}?rev=${flake_rev}&ref=${flake_ref}"; - flake_sha = flake_sha; + flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}"; + flake_sha = vars.flake_sha; }; }; } diff --git a/terranix/containers/home-assistant/default.nix b/terranix/containers/home-assistant/default.nix index a61092b..68c394d 100644 --- a/terranix/containers/home-assistant/default.nix +++ b/terranix/containers/home-assistant/default.nix @@ -1,13 +1,8 @@ -{ elib, ... }: +{ elib, vars, ... }: let inherit (elib) nfsVolume nomadJob; - - flake_host = ""; - flake_rev = ""; - flake_ref = ""; - flake_sha = ""; in { resource."nomad_volume"."home-assistant_hass" = nfsVolume { @@ -77,8 +72,8 @@ in jobspec = ./job.hcl; vars = { - flake_ref = "${flake_host}?rev=${flake_rev}&ref=${flake_ref}"; - flake_sha = flake_sha; + flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}"; + flake_sha = vars.flake_sha; }; }; } diff --git a/terranix/containers/hydra/default.nix b/terranix/containers/hydra/default.nix index 83edf6f..0deda2c 100644 --- a/terranix/containers/hydra/default.nix +++ b/terranix/containers/hydra/default.nix @@ -1,13 +1,8 @@ -{ config, elib, ... }: +{ config, elib, vars, ... }: let inherit (elib) nfsVolume nomadJob; - - flake_host = ""; - flake_rev = ""; - flake_ref = ""; - flake_sha = ""; in { resource."nomad_volume"."hydra-db" = nfsVolume { @@ -47,8 +42,8 @@ in jobspec = ./job.hcl; vars = { - flake_ref = "${flake_host}?rev=${flake_rev}&ref=${flake_ref}"; - flake_sha = flake_sha; + flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}"; + flake_sha = vars.flake_sha; }; }; } diff --git a/terranix/containers/ingress-blowhole/default.nix b/terranix/containers/ingress-blowhole/default.nix index 1d8557e..c004baf 100644 --- a/terranix/containers/ingress-blowhole/default.nix +++ b/terranix/containers/ingress-blowhole/default.nix @@ -1,20 +1,15 @@ -{ elib, ... }: +{ elib, vars, ... }: let inherit (elib) nomadJob; - - flake_host = ""; - flake_rev = ""; - flake_ref = ""; - flake_sha = ""; in { resource."nomad_job"."ingress" = nomadJob { jobspec = ./job.hcl; vars = { - flake_ref = "${flake_host}?rev=${flake_rev}&ref=${flake_ref}"; - flake_sha = flake_sha; + flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}"; + flake_sha = vars.flake_sha; upstreams = "\${file(\"${./upstreams.conf}\")}"; }; }; diff --git a/terranix/containers/ingress-toothpick/default.nix b/terranix/containers/ingress-toothpick/default.nix index d947245..fe6e17f 100644 --- a/terranix/containers/ingress-toothpick/default.nix +++ b/terranix/containers/ingress-toothpick/default.nix @@ -1,13 +1,8 @@ -{ elib, secret, ... }: +{ elib, secret, vars, ... }: let inherit (elib) nfsVolume nomadJob; - - flake_host = ""; - flake_rev = ""; - flake_ref = ""; - flake_sha = ""; in { resource."nomad_volume"."ingress-letsencrypt" = nfsVolume { @@ -21,8 +16,8 @@ in resource."nomad_job"."ingress" = nomadJob { jobspec = ./job.hcl; vars = { - flake_ref = "${flake_host}?rev=${flake_rev}&ref=${flake_ref}"; - flake_sha = flake_sha; + flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}"; + flake_sha = vars.flake_sha; upstreams = "\${file(\"${./upstreams.conf}\")}"; }; }; diff --git a/terranix/containers/matrix/default.nix b/terranix/containers/matrix/default.nix index bb634bf..fd4654c 100644 --- a/terranix/containers/matrix/default.nix +++ b/terranix/containers/matrix/default.nix @@ -1,13 +1,8 @@ -{ config, elib, ... }: +{ config, elib, vars, ... }: let inherit (elib) nfsVolume nomadJob; - - flake_host = ""; - flake_sha = ""; - flake_ref = ""; - flake_rev= ""; in { resource."nomad_volume"."matrix-synapse" = nfsVolume { @@ -143,32 +138,32 @@ in resource."nomad_job"."matrix-synapse" = nomadJob { jobspec = ./matrix-synapse.hcl; vars = { - flake_ref = "${flake_host}?ref=${flake_ref}&rev=${flake_rev}"; - flake_sha = flake_sha; + flake_ref = "${vars.flake_host}?ref=${vars.flake_ref}&rev=${vars.flake_rev}"; + flake_sha = vars.flake_sha; }; }; resource."nomad_job"."matrix-mautrix-discord" = nomadJob { jobspec = ./matrix-mautrix-discord.hcl; vars = { - flake_ref = "${flake_host}?ref=${flake_ref}&rev=${flake_rev}"; - flake_sha = flake_sha; + flake_ref = "${vars.flake_host}?ref=${vars.flake_ref}&rev=${vars.flake_rev}"; + flake_sha = vars.flake_sha; }; }; resource."nomad_job"."matrix-mautrix-facebook" = nomadJob { jobspec = ./matrix-mautrix-facebook.hcl; vars = { - flake_ref = "${flake_host}?ref=${flake_ref}&rev=${flake_rev}"; - flake_sha = flake_sha; + flake_ref = "${vars.flake_host}?ref=${vars.flake_ref}&rev=${vars.flake_rev}"; + flake_sha = vars.flake_sha; }; }; resource."nomad_job"."matrix-mautrix-signal" = nomadJob { jobspec = ./matrix-mautrix-signal.hcl; vars = { - flake_ref = "${flake_host}?ref=${flake_ref}&rev=${flake_rev}"; - flake_sha = flake_sha; + flake_ref = "${vars.flake_host}?ref=${vars.flake_ref}&rev=${vars.flake_rev}"; + flake_sha = vars.flake_sha; }; }; @@ -176,8 +171,8 @@ in jobspec = ./matrix-heisenbridge.hcl; vars = { - flake_ref = "${flake_host}?ref=${flake_ref}&rev=${flake_rev}"; - flake_sha = flake_sha; + flake_ref = "${vars.flake_host}?ref=${vars.flake_ref}&rev=${vars.flake_rev}"; + flake_sha = vars.flake_sha; }; }; } diff --git a/terranix/containers/syncthing/default.nix b/terranix/containers/syncthing/default.nix index e0c5dfe..465ce7f 100644 --- a/terranix/containers/syncthing/default.nix +++ b/terranix/containers/syncthing/default.nix @@ -1,15 +1,10 @@ -{ pkgs, elib, ... }: +{ pkgs, elib, vars, ... }: let inherit (elib) nfsVolume nomadJob; sharePrefix = "/mnt/kyle/infrastructure/syncthing"; - - flake_host = ""; - flake_rev = ""; - flake_ref = ""; - flake_sha = ""; in { resource."nomad_volume"."syncthing-data" = nfsVolume { @@ -39,8 +34,8 @@ in resource."nomad_job"."syncthing" = nomadJob { jobspec = ./job.hcl; vars = { - flake_ref = "${flake_host}?rev=${flake_rev}&ref=${flake_ref}"; - flake_sha = flake_sha; + flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}"; + flake_sha = vars.flake_sha; }; }; }