feat: really easy to import in old versions of the site

This commit is contained in:
silver 2024-06-14 21:28:52 +01:00
parent 34f8f0eb8c
commit 5c8dcdef00
Signed by: silver
GPG key ID: 54E2C71918E93B74
2 changed files with 48 additions and 28 deletions

View file

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

View file

@ -9,7 +9,11 @@ with lib; let
name = "website"; name = "website";
cfg = config.services.skynet."${name}"; cfg = config.services.skynet."${name}";
in { 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}" = { options.services.skynet."${name}" = {
enable = mkEnableOption "Skynet Main Website"; enable = mkEnableOption "Skynet Main Website";
@ -17,9 +21,6 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.skynet.acme.domains = [ services.skynet.acme.domains = [
# the root one is already covered by teh certificate
"2017.skynet.ie"
"2009.skynet.ie"
"discord.skynet.ie" "discord.skynet.ie"
"public.skynet.ie" "public.skynet.ie"
"renew.skynet.ie" "renew.skynet.ie"
@ -32,16 +33,6 @@ in {
r_type = "A"; r_type = "A";
value = config.services.skynet.host.ip; 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"; record = "discord";
r_type = "CNAME"; 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 # a custom discord url, because we are too cheap otehrwise
"discord.skynet.ie" = { "discord.skynet.ie" = {
forceSSL = true; forceSSL = true;