feat: standardise all services to using `services.skynet."${name}";` format

This commit is contained in:
silver 2024-05-30 14:59:20 +01:00
parent 54b43c9962
commit f8c7860eb5
Signed by: silver
GPG key ID: 54E2C71918E93B74
25 changed files with 64 additions and 48 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -53,7 +53,7 @@ in {
host = host;
};
services.skynet_nextcloud = {
services.skynet.nextcloud = {
enable = true;
host = host;
};

View file

@ -54,7 +54,7 @@ in {
host = host;
};
services.skynet = {
services.skynet.website = {
host = host;
};
}

View file

@ -54,7 +54,7 @@ in {
host = host;
};
services.skynet_ulfm = {
services.skynet.ulfm = {
enable = true;
host = host;
};

View file

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

View file

@ -54,7 +54,7 @@ in {
host = host;
};
services.skynet_gitlab = {
services.skynet.gitlab = {
enable = true;
host = host;
};

View file

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

View file

@ -48,7 +48,7 @@ in {
++ groups_trusted;
# allow trainees access
services.skynet_ldap_client = {
services.skynet.ldap_client = {
groups = groups;
sudo_groups = groups;
};

View file

@ -54,7 +54,7 @@ in {
host = host;
};
services.skynet_games = {
services.skynet.games = {
enable = true;
host = host;
};

View file

@ -55,7 +55,7 @@ in {
services.skynet.backup.host = host;
services.skynet_users = {
services.skynet.website_users = {
host = host;
};
}

View file

@ -53,7 +53,7 @@ in {
host = host;
};
services.skynet_gitlab_runner = {
services.skynet.gitlab_runner = {
enable = true;
runner.name = "runner01";
};