From f8c7860eb5920d4c960c0fd085c307072c31a449 Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Thu, 30 May 2024 14:59:20 +0100 Subject: [PATCH] feat: standardise all services to using ``services.skynet."${name}";`` format --- applications/bitwarden/vaultwarden.nix | 5 +++-- applications/discord.nix | 6 ++++-- applications/email.nix | 5 +++-- applications/games.nix | 7 ++++--- applications/games/minecraft.nix | 5 +++-- applications/gitlab.nix | 7 ++++--- applications/gitlab_runner.nix | 5 +++-- applications/ldap/backend.nix | 6 ++++-- applications/ldap/client.nix | 7 ++++--- applications/ldap/server.nix | 7 ++++--- applications/nextcloud.nix | 7 ++++--- applications/skynet.ie.nix | 5 +++-- applications/skynet_users.nix | 9 +++++---- applications/ulfm.nix | 5 +++-- machines/_base.nix | 2 +- machines/cadie.nix | 2 +- machines/earth.nix | 2 +- machines/galatea.nix | 2 +- machines/gir.nix | 2 +- machines/glados.nix | 2 +- machines/kitt.nix | 6 +++--- machines/marvin.nix | 2 +- machines/optimus.nix | 2 +- machines/skynet.nix | 2 +- machines/wheatly.nix | 2 +- 25 files changed, 64 insertions(+), 48 deletions(-) diff --git a/applications/bitwarden/vaultwarden.nix b/applications/bitwarden/vaultwarden.nix index c4ab5a2..68698dd 100644 --- a/applications/bitwarden/vaultwarden.nix +++ b/applications/bitwarden/vaultwarden.nix @@ -6,7 +6,8 @@ ... }: with lib; let - cfg = config.services.skynet_vaultwarden; + name = "vaultwarden"; + cfg = config.services.skynet."${name}"; domain_sub = "pw"; domain = "${domain_sub}.skynet.ie"; @@ -17,7 +18,7 @@ in { ../nginx.nix ]; - options.services.skynet_vaultwarden = { + options.services.skynet."${name}" = { enable = mkEnableOption "Skynet vaultwarden server"; host = { diff --git a/applications/discord.nix b/applications/discord.nix index a4b08a4..df8f934 100644 --- a/applications/discord.nix +++ b/applications/discord.nix @@ -6,13 +6,14 @@ ... }: with lib; let - cfg = config.services.discord_bot; + name = "discord_bot"; + cfg = config.services.skynet."${name}"; in { imports = [ inputs.skynet_discord_bot.nixosModule."x86_64-linux" ]; - options.services.discord_bot = { + options.services.skynet."${name}" = { enable = mkEnableOption "Skynet LDAP backend server"; }; @@ -24,6 +25,7 @@ in { age.secrets.discord_mail.file = ../secrets/email/details.age; age.secrets.discord_wolves.file = ../secrets/wolves/details.age; + # this is what was imported services.skynet_discord_bot = { enable = true; diff --git a/applications/email.nix b/applications/email.nix index d60e65f..8ab3c72 100644 --- a/applications/email.nix +++ b/applications/email.nix @@ -6,7 +6,8 @@ ... }: with lib; let - cfg = config.services.skynet_email; + name = "email"; + cfg = config.services.skynet."${name}"; # create teh new strings create_filter_array = map (x: "(memberOf=cn=${x},ou=groups,${cfg.ldap.base})"); @@ -128,7 +129,7 @@ in { ../config/users.nix ]; - options.services.skynet_email = { + options.services.skynet."${name}" = { # options that need to be passed in to make this work enable = mkEnableOption "Skynet Email"; diff --git a/applications/games.nix b/applications/games.nix index 7ab1511..b6dd735 100644 --- a/applications/games.nix +++ b/applications/games.nix @@ -6,7 +6,8 @@ ... }: with lib; let - cfg = config.services.skynet_games; + name = "games"; + cfg = config.services.skynet."${name}"; in { imports = [ ./dns.nix @@ -14,7 +15,7 @@ in { ./games/minecraft.nix ]; - options.services.skynet_games = { + options.services.skynet."${name}" = { enable = mkEnableOption "Skynet Games"; host = { @@ -74,7 +75,7 @@ in { }; # the minecraft servers - services.skynet_games_minecraft = { + services.skynet.games_minecraft = { enable = true; host = { diff --git a/applications/games/minecraft.nix b/applications/games/minecraft.nix index 9768b64..4c20a69 100644 --- a/applications/games/minecraft.nix +++ b/applications/games/minecraft.nix @@ -6,7 +6,8 @@ ... }: with lib; let - cfg = config.services.skynet_games_minecraft; + name = "games_minecraft"; + cfg = config.services.skynet."${name}"; # got tired of how long this is so I created a var for it. short_domain = "${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}"; @@ -19,7 +20,7 @@ in { inputs.arion.nixosModules.arion ]; - options.services.skynet_games_minecraft = { + options.services.skynet."${name}" = { enable = mkEnableOption "Skynet Games Minecraft"; host = { diff --git a/applications/gitlab.nix b/applications/gitlab.nix index 355d4cf..32f0ddc 100644 --- a/applications/gitlab.nix +++ b/applications/gitlab.nix @@ -5,7 +5,8 @@ ... }: with lib; let - cfg = config.services.skynet_gitlab; + name = "gitlab"; + cfg = config.services.skynet."${name}"; domain_base = "${cfg.domain.base}.${cfg.domain.tld}"; domain_full = "${cfg.domain.sub}.${domain_base}"; @@ -17,7 +18,7 @@ in { ./nginx.nix ]; - options.services.skynet_gitlab = { + options.services.skynet."${name}" = { enable = mkEnableOption "Skynet Gitlab"; host = { @@ -43,7 +44,7 @@ in { sub = mkOption { type = types.str; - default = "gitlab"; + default = name; }; }; diff --git a/applications/gitlab_runner.nix b/applications/gitlab_runner.nix index c6dda6b..dc642cf 100644 --- a/applications/gitlab_runner.nix +++ b/applications/gitlab_runner.nix @@ -5,12 +5,13 @@ ... }: with lib; let - cfg = config.services.skynet_gitlab_runner; + name = "gitlab_runner"; + cfg = config.services.skynet."${name}"; in { imports = [ ]; - options.services.skynet_gitlab_runner = { + options.services.skynet."${name}" = { enable = mkEnableOption "Skynet Gitlab Runner"; runner = { diff --git a/applications/ldap/backend.nix b/applications/ldap/backend.nix index d94a61a..177add3 100644 --- a/applications/ldap/backend.nix +++ b/applications/ldap/backend.nix @@ -6,7 +6,8 @@ ... }: with lib; let - cfg = config.services.ldap_backend; + name = "ldap_backend"; + cfg = config.services.skynet."${name}"; port_backend = "8087"; in { imports = [ @@ -17,7 +18,7 @@ in { ../../config/users.nix ]; - options.services.ldap_backend = { + options.services.skynet."${name}" = { enable = mkEnableOption "Skynet LDAP backend server"; host = { @@ -74,6 +75,7 @@ in { locations."/".proxyPass = "http://localhost:${port_backend}"; }; + # this got imported services.skynet_ldap_backend = { enable = true; diff --git a/applications/ldap/client.nix b/applications/ldap/client.nix index b1102ad..038907d 100644 --- a/applications/ldap/client.nix +++ b/applications/ldap/client.nix @@ -5,7 +5,8 @@ ... }: with lib; let - cfg = config.services.skynet_ldap_client; + name = "ldap_client"; + cfg = config.services.skynet."${name}"; # always ensure the admin group has access create_filter_check_admin = x: @@ -27,9 +28,9 @@ in { imports = []; # give users access to this server - #services.skynet_ldap_client.groups = ["skynet-users-linux"]; + #services.skynet.ldap_client.groups = ["skynet-users-linux"]; - options.services.skynet_ldap_client = { + options.services.skynet."${name}" = { # options that need to be passed in to make this work enable = mkEnableOption "Skynet LDAP client"; diff --git a/applications/ldap/server.nix b/applications/ldap/server.nix index e54c7e5..9f041f0 100644 --- a/applications/ldap/server.nix +++ b/applications/ldap/server.nix @@ -9,7 +9,8 @@ Gonna use a priper nixos module for this ... }: with lib; let - cfg = config.services.skynet_ldap; + name = "ldap"; + cfg = config.services.skynet."${name}"; domain = "${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}"; in { # these are needed for teh program in question @@ -20,7 +21,7 @@ in { ./backend.nix ]; - options.services.skynet_ldap = { + options.services.skynet."${name}" = { # options that need to be passed in to make this work enable = mkEnableOption "Skynet LDAP service"; @@ -65,7 +66,7 @@ in { config = mkIf cfg.enable { # passthrough to the backend - services.ldap_backend = { + services.skynet.ldap_backend = { enable = true; host.ip = cfg.host.ip; host.name = cfg.host.name; diff --git a/applications/nextcloud.nix b/applications/nextcloud.nix index ae23a05..2b5bad6 100644 --- a/applications/nextcloud.nix +++ b/applications/nextcloud.nix @@ -5,7 +5,8 @@ ... }: with lib; let - cfg = config.services.skynet_nextcloud; + name = "nextcloud"; + cfg = config.services.skynet."${name}"; domain = "${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}"; in { imports = [ @@ -14,7 +15,7 @@ in { ./nginx.nix ]; - options.services.skynet_nextcloud = { + options.services.skynet."${name}" = { enable = mkEnableOption "Skynet Nextcloud"; host = { @@ -40,7 +41,7 @@ in { sub = mkOption { type = types.str; - default = "nextcloud"; + default = name; }; }; }; diff --git a/applications/skynet.ie.nix b/applications/skynet.ie.nix index 37dfe0d..107dc89 100644 --- a/applications/skynet.ie.nix +++ b/applications/skynet.ie.nix @@ -6,14 +6,15 @@ ... }: with lib; let - cfg = config.services.skynet; + name = "website"; + cfg = config.services.skynet."${name}"; in { imports = [ ./acme.nix ./dns.nix ]; - options.services.skynet = { + options.services.skynet."${name}" = { host = { ip = mkOption { type = types.str; diff --git a/applications/skynet_users.nix b/applications/skynet_users.nix index 8e0b98f..341822d 100644 --- a/applications/skynet_users.nix +++ b/applications/skynet_users.nix @@ -6,8 +6,9 @@ ... }: with lib; let - cfg = config.services.skynet_users; - php_pool = "skynet_users"; + name = "website_users"; + cfg = config.services.skynet."${name}"; + php_pool = name; in { imports = [ ./acme.nix @@ -15,7 +16,7 @@ in { ./nginx.nix ]; - options.services.skynet_users = { + options.services.skynet."${name}" = { host = { ip = mkOption { type = types.str; @@ -30,7 +31,7 @@ in { # ssh access # allow more than admins access - services.skynet_ldap_client = { + services.skynet.ldap_client = { groups = [ "skynet-admins-linux" "skynet-users-linux" diff --git a/applications/ulfm.nix b/applications/ulfm.nix index 4cf88ad..77c4401 100644 --- a/applications/ulfm.nix +++ b/applications/ulfm.nix @@ -5,7 +5,8 @@ ... }: with lib; let - cfg = config.services.skynet_ulfm; + name = "ulfm"; + cfg = config.services.skynet."${name}"; in { imports = [ ./acme.nix @@ -14,7 +15,7 @@ in { ./nginx.nix ]; - options.services.skynet_ulfm = { + options.services.skynet."${name}" = { enable = mkEnableOption "ULFM service"; host = { diff --git a/machines/_base.nix b/machines/_base.nix index 63acbb5..80a8f5e 100644 --- a/machines/_base.nix +++ b/machines/_base.nix @@ -98,7 +98,7 @@ in { }; # skynet-admin-linux will always be added, individual servers can override the groups option - services.skynet_ldap_client.enable = true; + services.skynet.ldap_client.enable = true; networking = { # every sever needs to be accessable over ssh for admin use at least diff --git a/machines/cadie.nix b/machines/cadie.nix index acc6810..d180703 100644 --- a/machines/cadie.nix +++ b/machines/cadie.nix @@ -53,7 +53,7 @@ in { host = host; }; - services.skynet_nextcloud = { + services.skynet.nextcloud = { enable = true; host = host; }; diff --git a/machines/earth.nix b/machines/earth.nix index 9cfefd2..9854f34 100644 --- a/machines/earth.nix +++ b/machines/earth.nix @@ -54,7 +54,7 @@ in { host = host; }; - services.skynet = { + services.skynet.website = { host = host; }; } diff --git a/machines/galatea.nix b/machines/galatea.nix index 8c842af..c32d38b 100644 --- a/machines/galatea.nix +++ b/machines/galatea.nix @@ -54,7 +54,7 @@ in { host = host; }; - services.skynet_ulfm = { + services.skynet.ulfm = { enable = true; host = host; }; diff --git a/machines/gir.nix b/machines/gir.nix index 3121a19..07c5893 100644 --- a/machines/gir.nix +++ b/machines/gir.nix @@ -55,7 +55,7 @@ in { }; # we use this to pass in teh relevent infomation to the - services.skynet_email = { + services.skynet.email = { enable = true; host = host; domain = "skynet.ie"; diff --git a/machines/glados.nix b/machines/glados.nix index a28e836..7b0a277 100644 --- a/machines/glados.nix +++ b/machines/glados.nix @@ -54,7 +54,7 @@ in { host = host; }; - services.skynet_gitlab = { + services.skynet.gitlab = { enable = true; host = host; }; diff --git a/machines/kitt.nix b/machines/kitt.nix index 6b8dd7c..29fae63 100644 --- a/machines/kitt.nix +++ b/machines/kitt.nix @@ -60,16 +60,16 @@ in { host = host; }; - services.skynet_ldap = { + services.skynet.ldap = { enable = true; host = host; }; - services.discord_bot = { + services.skynet.discord_bot = { enable = true; }; - services.skynet_vaultwarden = { + services.skynet.vaultwarden = { enable = true; host = host; diff --git a/machines/marvin.nix b/machines/marvin.nix index 1be7d49..df99a32 100644 --- a/machines/marvin.nix +++ b/machines/marvin.nix @@ -48,7 +48,7 @@ in { ++ groups_trusted; # allow trainees access - services.skynet_ldap_client = { + services.skynet.ldap_client = { groups = groups; sudo_groups = groups; }; diff --git a/machines/optimus.nix b/machines/optimus.nix index 0e7a1f6..111cadf 100644 --- a/machines/optimus.nix +++ b/machines/optimus.nix @@ -54,7 +54,7 @@ in { host = host; }; - services.skynet_games = { + services.skynet.games = { enable = true; host = host; }; diff --git a/machines/skynet.nix b/machines/skynet.nix index 435bbc5..0d1442c 100644 --- a/machines/skynet.nix +++ b/machines/skynet.nix @@ -55,7 +55,7 @@ in { services.skynet.backup.host = host; - services.skynet_users = { + services.skynet.website_users = { host = host; }; } diff --git a/machines/wheatly.nix b/machines/wheatly.nix index 3e6f339..b285ce9 100644 --- a/machines/wheatly.nix +++ b/machines/wheatly.nix @@ -53,7 +53,7 @@ in { host = host; }; - services.skynet_gitlab_runner = { + services.skynet.gitlab_runner = { enable = true; runner.name = "runner01"; };