Create a way to deploy rest of terranix without containers

Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
Magic_RB 2023-06-29 17:11:13 +02:00
parent 878b4f0d95
commit 0d4698ab78
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E
15 changed files with 79 additions and 20 deletions

View file

@ -1058,11 +1058,11 @@
"terranix": "terranix" "terranix": "terranix"
}, },
"locked": { "locked": {
"lastModified": 1687130036, "lastModified": 1687982768,
"narHash": "sha256-U7q2iwNNdB0A7GHyLjNYLWluOVJO+K0LtiOV0Y3/vuY=", "narHash": "sha256-GofM1CCW5l4hQtgea7lqUMQs4kRc/unx9As/vGG92hg=",
"owner": "~magic_rb", "owner": "~magic_rb",
"repo": "uterranix", "repo": "uterranix",
"rev": "30dd60117a71c3f6bb152af03ef6f7fd686abf1c", "rev": "9ee50d0b284d76cd5b2abde709c927066d2c319b",
"type": "sourcehut" "type": "sourcehut"
}, },
"original": { "original": {

View file

@ -110,6 +110,15 @@
nixos = mapAttrs (_: v: v.config.system.build.toplevel) config.flake.nixosConfigurations; nixos = mapAttrs (_: v: v.config.system.build.toplevel) config.flake.nixosConfigurations;
}; };
uterranix.preCommands = ''
TF_VAR_dont_deploy_containers=false
if [ "${self.rev or ""}" == "" ] || [ "${self.narHask or ""}" == "" ]
then
TF_VAR_dont_deploy_containers=true
fi
export TF_VAR_dont_deploy_containers
'';
uterranix.config = [ uterranix.config = [
./terranix/default.nix ./terranix/default.nix
{ {

View file

@ -1,7 +1,15 @@
{ ... }: { pkgs, ... }:
{ {
services.pantalaimon = { services.pantalaimon = {
enable = true; enable = true;
package = pkgs.pantalaimon.overrideAttrs (old: {
src = pkgs.fetchFromGitHub {
owner = "matrix-org";
repo = "pantalaimon";
rev = "3968c69aa846889970df1372ba9aa54c1c5e4290";
hash = "sha256-JdoJB68QtxPhFeZCHd+0ZOlUDbQV3HeBsxW0KbhnDSs=";
};
});
settings = settings =
{ {
Default = Default =

View file

@ -1,10 +1,17 @@
{ elib, vars, ... }: { elib, tflib, vars, ... }:
let let
inherit (elib) inherit (elib)
nfsVolume nfsVolume
nomadJob; nomadJob;
inherit (tflib)
tf;
in in
{ {
variable."dont_deploy_containers" = {
type = "boolean";
description = "Whether the data to deploy containers properly is available.";
};
resource."vault_policy"."dovecot-policy" = nfsVolume { resource."vault_policy"."dovecot-policy" = nfsVolume {
name = "dovecot-policy"; name = "dovecot-policy";
policy = '' policy = ''
@ -40,6 +47,7 @@ in
}; };
resource."nomad_job"."email" = { resource."nomad_job"."email" = {
count = tf "var.dont_deploy_containers ? 0 : 1";
jobspec = ./job.hcl; jobspec = ./job.hcl;
vars = { vars = {
flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}"; flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}";

View file

@ -1,10 +1,13 @@
{ elib, ... }: { tflib, elib, ... }:
let let
inherit (elib) inherit (elib)
nomadJob; nomadJob;
inherit (tflib)
tf;
in in
{ {
resource."nomad_job"."mesh" = nomadJob { resource."nomad_job"."mesh" = nomadJob {
count = tf "var.dont_deploy_containers ? 0 : 1";
jobspec = ./job.hcl; jobspec = ./job.hcl;
vars = { vars = {
"datacenters" = builtins.toJSON [ "datacenters" = builtins.toJSON [

View file

@ -1,8 +1,10 @@
{ elib, vars, ... }: { tflib, elib, vars, ... }:
let let
inherit (elib) inherit (elib)
nfsVolume nfsVolume
nomadJob; nomadJob;
inherit (tflib)
tf;
in in
{ {
resource."nomad_volume"."gitea-db" = nfsVolume { resource."nomad_volume"."gitea-db" = nfsVolume {
@ -31,8 +33,8 @@ in
}; };
resource."nomad_job"."gitea" = nomadJob { resource."nomad_job"."gitea" = nomadJob {
count = tf "var.dont_deploy_containers ? 0 : 1";
jobspec = ./job.hcl; jobspec = ./job.hcl;
vars = { vars = {
flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}"; flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}";
flake_sha = vars.flake_sha; flake_sha = vars.flake_sha;

View file

@ -1,8 +1,10 @@
{ elib, vars, ... }: { tflib, elib, vars, ... }:
let let
inherit (elib) inherit (elib)
nfsVolume nfsVolume
nomadJob; nomadJob;
inherit (tflib)
tf;
in in
{ {
resource."nomad_volume"."home-assistant_hass" = nfsVolume { resource."nomad_volume"."home-assistant_hass" = nfsVolume {
@ -69,8 +71,8 @@ in
}; };
resource."nomad_job"."home-assistant" = nomadJob { resource."nomad_job"."home-assistant" = nomadJob {
count = tf "var.dont_deploy_containers ? 0 : 1";
jobspec = ./job.hcl; jobspec = ./job.hcl;
vars = { vars = {
flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}"; flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}";
flake_sha = vars.flake_sha; flake_sha = vars.flake_sha;

View file

@ -1,8 +1,10 @@
{ config, elib, vars, ... }: { config, tflib, elib, vars, ... }:
let let
inherit (elib) inherit (elib)
nfsVolume nfsVolume
nomadJob; nomadJob;
inherit (tflib)
tf;
in in
{ {
resource."nomad_volume"."hydra-db" = nfsVolume { resource."nomad_volume"."hydra-db" = nfsVolume {
@ -39,8 +41,8 @@ in
}; };
resource."nomad_job"."hydra" = nomadJob { resource."nomad_job"."hydra" = nomadJob {
count = tf "var.dont_deploy_containers ? 0 : 1";
jobspec = ./job.hcl; jobspec = ./job.hcl;
vars = { vars = {
flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}"; flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}";
flake_sha = vars.flake_sha; flake_sha = vars.flake_sha;

View file

@ -1,12 +1,14 @@
{ elib, vars, ... }: { tflib, elib, vars, ... }:
let let
inherit (elib) inherit (elib)
nomadJob; nomadJob;
inherit (tflib)
tf;
in in
{ {
resource."nomad_job"."ingress" = nomadJob { resource."nomad_job"."ingress" = nomadJob {
count = tf "var.dont_deploy_containers ? 0 : 1";
jobspec = ./job.hcl; jobspec = ./job.hcl;
vars = { vars = {
flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}"; flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}";
flake_sha = vars.flake_sha; flake_sha = vars.flake_sha;

View file

@ -1,8 +1,10 @@
{ elib, secret, vars, ... }: { tflib, elib, secret, vars, ... }:
let let
inherit (elib) inherit (elib)
nfsVolume nfsVolume
nomadJob; nomadJob;
inherit (tflib)
tf;
in in
{ {
resource."nomad_volume"."ingress-letsencrypt" = nfsVolume { resource."nomad_volume"."ingress-letsencrypt" = nfsVolume {
@ -14,6 +16,7 @@ in
}; };
resource."nomad_job"."ingress" = nomadJob { resource."nomad_job"."ingress" = nomadJob {
count = tf "var.dont_deploy_containers ? 0 : 1";
jobspec = ./job.hcl; jobspec = ./job.hcl;
vars = { vars = {
flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}"; flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}";

View file

@ -1,8 +1,10 @@
{ elib, ... }: { tflib, elib, ... }:
let let
inherit (elib) inherit (elib)
nfsVolume nfsVolume
nomadJob; nomadJob;
inherit (tflib)
tf;
in in
{ {
resource."nomad_volume"."jellyfin-cache" = nfsVolume { resource."nomad_volume"."jellyfin-cache" = nfsVolume {
@ -30,6 +32,7 @@ in
}; };
resource."nomad_job"."jellyfin" = nomadJob { resource."nomad_job"."jellyfin" = nomadJob {
count = tf "var.dont_deploy_containers ? 0 : 1";
jobspec = ./job.hcl; jobspec = ./job.hcl;
}; };
} }

View file

@ -1,8 +1,10 @@
{ config, elib, vars, ... }: { config, tflib, elib, vars, ... }:
let let
inherit (elib) inherit (elib)
nfsVolume nfsVolume
nomadJob; nomadJob;
inherit (tflib)
tf;
in in
{ {
resource."nomad_volume"."matrix-synapse" = nfsVolume { resource."nomad_volume"."matrix-synapse" = nfsVolume {
@ -136,6 +138,7 @@ in
}; };
resource."nomad_job"."matrix-synapse" = nomadJob { resource."nomad_job"."matrix-synapse" = nomadJob {
count = tf "var.dont_deploy_containers ? 0 : 1";
jobspec = ./matrix-synapse.hcl; jobspec = ./matrix-synapse.hcl;
vars = { vars = {
flake_ref = "${vars.flake_host}?ref=${vars.flake_ref}&rev=${vars.flake_rev}"; flake_ref = "${vars.flake_host}?ref=${vars.flake_ref}&rev=${vars.flake_rev}";
@ -144,6 +147,7 @@ in
}; };
resource."nomad_job"."matrix-mautrix-discord" = nomadJob { resource."nomad_job"."matrix-mautrix-discord" = nomadJob {
count = tf "var.dont_deploy_containers ? 0 : 1";
jobspec = ./matrix-mautrix-discord.hcl; jobspec = ./matrix-mautrix-discord.hcl;
vars = { vars = {
flake_ref = "${vars.flake_host}?ref=${vars.flake_ref}&rev=${vars.flake_rev}"; flake_ref = "${vars.flake_host}?ref=${vars.flake_ref}&rev=${vars.flake_rev}";
@ -152,6 +156,7 @@ in
}; };
resource."nomad_job"."matrix-mautrix-facebook" = nomadJob { resource."nomad_job"."matrix-mautrix-facebook" = nomadJob {
count = tf "var.dont_deploy_containers ? 0 : 1";
jobspec = ./matrix-mautrix-facebook.hcl; jobspec = ./matrix-mautrix-facebook.hcl;
vars = { vars = {
flake_ref = "${vars.flake_host}?ref=${vars.flake_ref}&rev=${vars.flake_rev}"; flake_ref = "${vars.flake_host}?ref=${vars.flake_ref}&rev=${vars.flake_rev}";
@ -160,6 +165,7 @@ in
}; };
resource."nomad_job"."matrix-mautrix-signal" = nomadJob { resource."nomad_job"."matrix-mautrix-signal" = nomadJob {
count = tf "var.dont_deploy_containers ? 0 : 1";
jobspec = ./matrix-mautrix-signal.hcl; jobspec = ./matrix-mautrix-signal.hcl;
vars = { vars = {
flake_ref = "${vars.flake_host}?ref=${vars.flake_ref}&rev=${vars.flake_rev}"; flake_ref = "${vars.flake_host}?ref=${vars.flake_ref}&rev=${vars.flake_rev}";
@ -168,8 +174,8 @@ in
}; };
resource."nomad_job"."matrix-heisenbridge" = nomadJob { resource."nomad_job"."matrix-heisenbridge" = nomadJob {
count = tf "var.dont_deploy_containers ? 0 : 1";
jobspec = ./matrix-heisenbridge.hcl; jobspec = ./matrix-heisenbridge.hcl;
vars = { vars = {
flake_ref = "${vars.flake_host}?ref=${vars.flake_ref}&rev=${vars.flake_rev}"; flake_ref = "${vars.flake_host}?ref=${vars.flake_ref}&rev=${vars.flake_rev}";
flake_sha = vars.flake_sha; flake_sha = vars.flake_sha;

View file

@ -1,8 +1,10 @@
{ pkgs, elib, vars, ... }: { pkgs, tflib, elib, vars, ... }:
let let
inherit (elib) inherit (elib)
nfsVolume nfsVolume
nomadJob; nomadJob;
inherit (tflib)
tf;
sharePrefix = "/mnt/kyle/infrastructure/syncthing"; sharePrefix = "/mnt/kyle/infrastructure/syncthing";
in in
@ -32,6 +34,7 @@ in
}; };
resource."nomad_job"."syncthing" = nomadJob { resource."nomad_job"."syncthing" = nomadJob {
count = tf "var.dont_deploy_containers ? 0 : 1";
jobspec = ./job.hcl; jobspec = ./job.hcl;
vars = { vars = {
flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}"; flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}";

View file

@ -1,11 +1,14 @@
{ pkgs, elib, vars, ... }: { pkgs, tflib, elib, vars, ... }:
let let
inherit (elib) inherit (elib)
nfsVolume nfsVolume
nomadJob; nomadJob;
inherit (tflib)
tf;
in in
{ {
resource."nomad_job"."website" = nomadJob { resource."nomad_job"."website" = nomadJob {
count = tf "var.dont_deploy_containers ? 0 : 1";
jobspec = ./job.hcl; jobspec = ./job.hcl;
vars = { vars = {
flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}"; flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}";

View file

@ -42,6 +42,11 @@ in
sensitive = true; sensitive = true;
}; };
variable."dont_deploy_containers" = {
type = "boolean";
description = "Whether the data to deploy containers properly is available.";
};
provider."hcloud" = { provider."hcloud" = {
token = tf "var.hcloud_token"; token = tf "var.hcloud_token";
}; };