From 5c8dcdef000bc22c10f29c128ece3c0cf2dcab18 Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Fri, 14 Jun 2024 21:28:52 +0100 Subject: [PATCH] feat: really easy to import in old versions of the site --- applications/skynet.ie/old_site.nix | 43 ++++++++++++++++++++++++++++ applications/skynet.ie/skynet.ie.nix | 33 ++++----------------- 2 files changed, 48 insertions(+), 28 deletions(-) create mode 100644 applications/skynet.ie/old_site.nix diff --git a/applications/skynet.ie/old_site.nix b/applications/skynet.ie/old_site.nix new file mode 100644 index 0000000..3b4a211 --- /dev/null +++ b/applications/skynet.ie/old_site.nix @@ -0,0 +1,43 @@ +{year}: { + config, + pkgs, + lib, + inputs, + ... +}: +with lib; { + imports = []; + + config = { + assertions = [ + { + assertion = asserts.assertOneOf "year" year [ + "2009" + "2017" + ]; + } + ]; + + services.skynet.acme.domains = [ + "${year}.skynet.ie" + ]; + + services.skynet.dns.records = [ + { + record = year; + r_type = "CNAME"; + value = config.services.skynet.host.name; + } + ]; + + services.nginx = { + virtualHosts = { + "${year}.skynet.ie" = { + forceSSL = true; + useACMEHost = "skynet"; + root = "${inputs."skynet_website_${year}".defaultPackage."x86_64-linux"}"; + }; + }; + }; + }; +} diff --git a/applications/skynet.ie/skynet.ie.nix b/applications/skynet.ie/skynet.ie.nix index fa69885..b5bcdf9 100644 --- a/applications/skynet.ie/skynet.ie.nix +++ b/applications/skynet.ie/skynet.ie.nix @@ -9,7 +9,11 @@ with lib; let name = "website"; cfg = config.services.skynet."${name}"; in { - imports = []; + imports = [ + # import in past website versions, available at $year.skynet.ie + (import ./old_site.nix {year = "2009";}) + (import ./old_site.nix {year = "2017";}) + ]; options.services.skynet."${name}" = { enable = mkEnableOption "Skynet Main Website"; @@ -17,9 +21,6 @@ in { config = mkIf cfg.enable { services.skynet.acme.domains = [ - # the root one is already covered by teh certificate - "2017.skynet.ie" - "2009.skynet.ie" "discord.skynet.ie" "public.skynet.ie" "renew.skynet.ie" @@ -32,16 +33,6 @@ in { r_type = "A"; value = config.services.skynet.host.ip; } - { - record = "2017"; - r_type = "CNAME"; - value = config.services.skynet.host.name; - } - { - record = "2009"; - r_type = "CNAME"; - value = config.services.skynet.host.name; - } { record = "discord"; r_type = "CNAME"; @@ -77,20 +68,6 @@ in { }; }; - # 2017 to now - "2017.skynet.ie" = { - forceSSL = true; - useACMEHost = "skynet"; - root = "${inputs.skynet_website_2017.defaultPackage."x86_64-linux"}"; - }; - - # archive of teh site as it was ~2009 to 2017 - "2009.skynet.ie" = { - forceSSL = true; - useACMEHost = "skynet"; - root = "${inputs.skynet_website_2009.defaultPackage."x86_64-linux"}"; - }; - # a custom discord url, because we are too cheap otehrwise "discord.skynet.ie" = { forceSSL = true;