diff --git a/applications/skynet.ie/skynet.ie.nix b/applications/skynet.ie/skynet.ie.nix index 6a2afd3..fcb46e7 100644 --- a/applications/skynet.ie/skynet.ie.nix +++ b/applications/skynet.ie/skynet.ie.nix @@ -25,7 +25,6 @@ in { services.skynet.acme.domains = [ "discord.skynet.ie" "public.skynet.ie" - "renew.skynet.ie" ]; services.skynet.dns.records = [ @@ -45,11 +44,6 @@ in { r_type = "CNAME"; value = config.services.skynet.host.name; } - { - record = "renew"; - r_type = "CNAME"; - value = config.services.skynet.host.name; - } ]; services.nginx = { @@ -82,13 +76,6 @@ in { root = "${inputs.compsoc_public.packages.x86_64-linux.default}"; locations."/".extraConfig = "autoindex on;"; }; - - # for alumni members to renew their account - "renew.skynet.ie" = { - forceSSL = true; - useACMEHost = "skynet"; - root = "${inputs.skynet_website_renew.defaultPackage."x86_64-linux"}"; - }; }; }; }; diff --git a/applications/skynet.ie/wiki.nix b/applications/skynet.ie/wiki.nix new file mode 100644 index 0000000..a447a1f --- /dev/null +++ b/applications/skynet.ie/wiki.nix @@ -0,0 +1,55 @@ +{ + config, + pkgs, + lib, + inputs, + ... +}: +with lib; let + name = "wiki"; + cfg = config.services.skynet."${name}"; +in { + imports = [ + ]; + + options.services.skynet."${name}" = { + enable = mkEnableOption "Skynet Wiki"; + }; + + config = mkIf cfg.enable { + services.skynet.acme.domains = [ + "renew.skynet.ie" + "wiki.skynet.ie" + ]; + + services.skynet.dns.records = [ + { + record = "renew"; + r_type = "CNAME"; + value = config.services.skynet.host.name; + } + { + record = "wiki"; + r_type = "CNAME"; + value = config.services.skynet.host.name; + } + ]; + + services.nginx = { + virtualHosts = { + "wiki.skynet.ie" = { + forceSSL = true; + useACMEHost = "skynet"; + root = "${inputs.skynet_website_renew.defaultPackage."x86_64-linux"}"; + }; + + # redirect old links to the new wiki + "renew.skynet.ie" = { + forceSSL = true; + useACMEHost = "skynet"; + locations."/".return = "307 https://wiki.skynet.ie"; + }; + }; + }; + }; +} diff --git a/machines/earth.nix b/machines/earth.nix index 4e63521..fadcef1 100644 --- a/machines/earth.nix +++ b/machines/earth.nix @@ -26,6 +26,7 @@ Notes: in { imports = [ ../applications/skynet.ie/skynet.ie.nix + ../applications/skynet.ie/wiki.nix ]; deployment = { @@ -40,5 +41,6 @@ in { host = host; backup.enable = true; website.enable = true; + wiki.enable = true; }; }