From 54b43c9962dec9663c56b05aab72fff1e7788cea Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Thu, 30 May 2024 14:11:45 +0100 Subject: [PATCH] feat: use a host attribute to make the config less verbose/complex --- machines/agentjones.nix | 9 +++++---- machines/cadie.nix | 14 ++++++-------- machines/earth.nix | 14 ++++++-------- machines/galatea.nix | 14 ++++++-------- machines/gir.nix | 15 ++++++--------- machines/glados.nix | 14 ++++++-------- machines/kitt.nix | 30 +++++++++--------------------- machines/marvin.nix | 9 +++++---- machines/neuromancer.nix | 9 +++++---- machines/optimus.nix | 14 ++++++-------- machines/skynet.nix | 14 ++++++-------- machines/vendetta.nix | 9 +++++---- machines/vigil.nix | 9 +++++---- machines/wheatly.nix | 9 +++++---- 14 files changed, 81 insertions(+), 102 deletions(-) diff --git a/machines/agentjones.nix b/machines/agentjones.nix index 5748b53..ee05feb 100644 --- a/machines/agentjones.nix +++ b/machines/agentjones.nix @@ -17,6 +17,10 @@ Notes: Used to have Agent Smith as a partner but it died (Ironically) name = "agentjones"; ip_pub = "193.1.99.72"; hostname = "${name}.skynet.ie"; + host = { + ip = ip_pub; + name = name; + }; in { imports = [ ./hardware/RM001.nix @@ -46,10 +50,7 @@ in { ]; services.skynet.backup = { - host = { - ip = ip_pub; - name = name; - }; + host = host; }; # keep the wired usb connection alive (front panel) diff --git a/machines/cadie.nix b/machines/cadie.nix index c9a8ed0..acc6810 100644 --- a/machines/cadie.nix +++ b/machines/cadie.nix @@ -18,6 +18,10 @@ Notes: name = "cadie"; ip_pub = "193.1.99.77"; hostname = "${name}.skynet.ie"; + host = { + ip = ip_pub; + name = name; + }; in { imports = [ ../applications/nextcloud.nix @@ -46,18 +50,12 @@ in { ]; services.skynet.backup = { - host = { - ip = ip_pub; - name = name; - }; + host = host; }; services.skynet_nextcloud = { enable = true; - host = { - ip = ip_pub; - name = name; - }; + host = host; }; # this was causing a conflict for some reason diff --git a/machines/earth.nix b/machines/earth.nix index 534ffcd..9cfefd2 100644 --- a/machines/earth.nix +++ b/machines/earth.nix @@ -18,6 +18,10 @@ Notes: name = "earth"; ip_pub = "193.1.99.79"; hostname = "${name}.skynet.ie"; + host = { + ip = ip_pub; + name = name; + }; in { imports = [ ../applications/skynet.ie.nix @@ -47,16 +51,10 @@ in { ]; services.skynet.backup = { - host = { - ip = ip_pub; - name = name; - }; + host = host; }; services.skynet = { - host = { - ip = ip_pub; - name = name; - }; + host = host; }; } diff --git a/machines/galatea.nix b/machines/galatea.nix index 3df97b5..8c842af 100644 --- a/machines/galatea.nix +++ b/machines/galatea.nix @@ -19,6 +19,10 @@ Notes: name = "galatea"; ip_pub = "193.1.99.111"; hostname = "${name}.skynet.ie"; + host = { + ip = ip_pub; + name = name; + }; in { imports = [ ../applications/ulfm.nix @@ -47,17 +51,11 @@ in { ]; services.skynet.backup = { - host = { - ip = ip_pub; - name = name; - }; + host = host; }; services.skynet_ulfm = { enable = true; - host = { - ip = ip_pub; - name = name; - }; + host = host; }; } diff --git a/machines/gir.nix b/machines/gir.nix index c3dfb44..3121a19 100644 --- a/machines/gir.nix +++ b/machines/gir.nix @@ -18,7 +18,10 @@ Notes: name = "gir"; ip_pub = "193.1.99.76"; hostname = "${name}.skynet.ie"; - #hostname = ip_pub; + host = { + ip = ip_pub; + name = name; + }; in { imports = [ ../applications/email.nix @@ -48,19 +51,13 @@ in { ]; services.skynet.backup = { - host = { - ip = ip_pub; - name = name; - }; + host = host; }; # we use this to pass in teh relevent infomation to the services.skynet_email = { enable = true; - host = { - ip = ip_pub; - name = name; - }; + host = host; domain = "skynet.ie"; }; } diff --git a/machines/glados.nix b/machines/glados.nix index a6aa5dd..a28e836 100644 --- a/machines/glados.nix +++ b/machines/glados.nix @@ -19,6 +19,10 @@ Notes: Each user has roughly 20gb os storage name = "glados"; ip_pub = "193.1.99.75"; hostname = "${name}.skynet.ie"; + host = { + ip = ip_pub; + name = name; + }; in { imports = [ ../applications/gitlab.nix @@ -47,17 +51,11 @@ in { ]; services.skynet.backup = { - host = { - ip = ip_pub; - name = name; - }; + host = host; }; services.skynet_gitlab = { enable = true; - host = { - ip = ip_pub; - name = name; - }; + host = host; }; } diff --git a/machines/kitt.nix b/machines/kitt.nix index 4c39703..6b8dd7c 100644 --- a/machines/kitt.nix +++ b/machines/kitt.nix @@ -19,7 +19,10 @@ Notes: name = "kitt"; ip_pub = "193.1.99.74"; hostname = "${name}.skynet.ie"; - #hostname = ip_pub; + host = { + ip = ip_pub; + name = name; + }; in { imports = [ ../applications/ldap/server.nix @@ -54,18 +57,12 @@ in { ]; services.skynet.backup = { - host = { - ip = ip_pub; - name = name; - }; + host = host; }; services.skynet_ldap = { enable = true; - host = { - ip = ip_pub; - name = name; - }; + host = host; }; services.discord_bot = { @@ -75,27 +72,18 @@ in { services.skynet_vaultwarden = { enable = true; - host = { - ip = ip_pub; - name = name; - }; + host = host; }; services.skynet.prometheus = { server = { enable = true; - host = { - ip = ip_pub; - name = name; - }; + host = host; }; }; services.skynet.grafana = { enable = true; - host = { - ip = ip_pub; - name = name; - }; + host = host; }; } diff --git a/machines/marvin.nix b/machines/marvin.nix index e44332f..1be7d49 100644 --- a/machines/marvin.nix +++ b/machines/marvin.nix @@ -17,6 +17,10 @@ Notes: name = "marvin"; ip_pub = "193.1.99.81"; hostname = "${name}.skynet.ie"; + host = { + ip = ip_pub; + name = name; + }; groups = [ "skynet-admins-linux" @@ -64,10 +68,7 @@ in { ]; services.skynet.backup = { - host = { - ip = ip_pub; - name = name; - }; + host = host; }; # Put test services below this diff --git a/machines/neuromancer.nix b/machines/neuromancer.nix index 323e859..255c503 100644 --- a/machines/neuromancer.nix +++ b/machines/neuromancer.nix @@ -18,6 +18,10 @@ Notes: name = "neuromancer"; ip_pub = "193.1.99.80"; hostname = "${name}.skynet.ie"; + host = { + ip = ip_pub; + name = name; + }; in { imports = [ ./hardware/RM007.nix @@ -60,9 +64,6 @@ in { services.skynet.backup = { server.enable = true; - host = { - ip = ip_pub; - name = name; - }; + host = host; }; } diff --git a/machines/optimus.nix b/machines/optimus.nix index 3f44061..0e7a1f6 100644 --- a/machines/optimus.nix +++ b/machines/optimus.nix @@ -19,6 +19,10 @@ Notes: name = "optimus"; ip_pub = "193.1.99.112"; hostname = "${name}.skynet.ie"; + host = { + ip = ip_pub; + name = name; + }; in { imports = [ ../applications/games.nix @@ -47,17 +51,11 @@ in { ]; services.skynet.backup = { - host = { - ip = ip_pub; - name = name; - }; + host = host; }; services.skynet_games = { enable = true; - host = { - ip = ip_pub; - name = name; - }; + host = host; }; } diff --git a/machines/skynet.nix b/machines/skynet.nix index 5f1cb63..435bbc5 100644 --- a/machines/skynet.nix +++ b/machines/skynet.nix @@ -21,6 +21,10 @@ Notes: Does not host offical sites # for internal network connectivity ip_int = "193.1.99.82"; hostname = "${name}.skynet.ie"; + host = { + ip = ip_pub; + name = name; + }; in { imports = [ ../applications/skynet_users.nix @@ -49,15 +53,9 @@ in { } ]; - services.skynet.backup.host = { - ip = ip_pub; - name = name; - }; + services.skynet.backup.host = host; services.skynet_users = { - host = { - ip = ip_pub; - name = name; - }; + host = host; }; } diff --git a/machines/vendetta.nix b/machines/vendetta.nix index 702b724..c46c988 100644 --- a/machines/vendetta.nix +++ b/machines/vendetta.nix @@ -18,6 +18,10 @@ Notes: Using the server that used to be called Earth name = "vendetta"; ip_pub = "193.1.99.120"; hostname = "${name}.skynet.ie"; + host = { + ip = ip_pub; + name = name; + }; in { imports = [ ./hardware/RM002.nix @@ -46,10 +50,7 @@ in { }; services.skynet.backup = { - host = { - ip = ip_pub; - name = name; - }; + host = host; }; services.skynet.dns = { diff --git a/machines/vigil.nix b/machines/vigil.nix index 66abfb4..7885aa4 100644 --- a/machines/vigil.nix +++ b/machines/vigil.nix @@ -17,6 +17,10 @@ Notes: name = "vigil"; ip_pub = "193.1.99.109"; hostname = "${name}.skynet.ie"; + host = { + ip = ip_pub; + name = name; + }; in { imports = [ ]; @@ -30,10 +34,7 @@ in { }; services.skynet.backup = { - host = { - ip = ip_pub; - name = name; - }; + host = host; }; services.skynet.dns = { diff --git a/machines/wheatly.nix b/machines/wheatly.nix index 835e0ac..3e6f339 100644 --- a/machines/wheatly.nix +++ b/machines/wheatly.nix @@ -18,6 +18,10 @@ Notes: name = "wheatly"; ip_pub = "193.1.99.78"; hostname = "${name}.skynet.ie"; + host = { + ip = ip_pub; + name = name; + }; in { imports = [ ../applications/gitlab_runner.nix @@ -46,10 +50,7 @@ in { ]; services.skynet.backup = { - host = { - ip = ip_pub; - name = name; - }; + host = host; }; services.skynet_gitlab_runner = {