nixos/applications/skynet.ie/skynet.ie.nix
Brendan Golden b943e5ec0d
Some checks failed
Build_Deploy / deploy_active (active) (push) Blocked by required conditions
Build_Deploy / deploy_active (active-core) (push) Blocked by required conditions
Build_Deploy / deploy_active (active-ext) (push) Blocked by required conditions
Build_Deploy / linter (push) Successful in 11s
Build_Deploy / build (push) Successful in 39s
Build_Deploy / deploy_dns (push) Has been cancelled
fix: some errors with teh websites
also add 2024 snapshot
2025-04-04 00:58:37 +01:00

122 lines
3.2 KiB
Nix

{
config,
pkgs,
lib,
inputs,
...
}:
with lib; let
name = "website";
cfg = config.services.skynet."${name}";
in {
imports = [
# import in past website versions, available at $year.skynet.ie
# at teh end of teh year add it here
(import ./old_site.nix {year = "2024";})
(import ./old_site.nix {year = "2023";})
(import ./old_site.nix {year = "2021";})
(import ./old_site.nix {year = "2016";})
(import ./old_site.nix {year = "2006";})
(import ./old_site.nix {year = "2003";})
];
options.services.skynet."${name}" = {
enable = mkEnableOption "Skynet Main Website";
};
config = mkIf cfg.enable {
services.skynet.acme.domains = [
"*.skynet.ie"
"*.discord.skynet.ie"
];
services.skynet.dns.records = [
# means root domain, so skynet.ie
{
record = "@";
r_type = "A";
value = config.services.skynet.host.ip;
}
{
record = "www";
r_type = "CNAME";
value = config.services.skynet.host.name;
}
{
record = "discord";
r_type = "CNAME";
value = config.services.skynet.host.name;
}
{
record = "public";
r_type = "CNAME";
value = config.services.skynet.host.name;
}
{
record = "*.discord";
r_type = "CNAME";
value = config.services.skynet.host.name;
}
];
services.nginx = {
virtualHosts = let
main_site = {
forceSSL = true;
useACMEHost = "skynet";
locations = {
"/".root = "${inputs.skynet_website.defaultPackage."x86_64-linux"}";
# this redirects old links to new format
"~* ~(?<username>[a-z_0-9]*)(?<files>\\S*)$" = {
priority = 1;
return = "307 https://$username.users.skynet.ie$files";
};
};
};
in {
# main site
"www.skynet.ie" = main_site;
"skynet.ie" = main_site;
# a custom discord url, because we are too cheap otehrwise
"discord.skynet.ie" = {
forceSSL = true;
useACMEHost = "skynet";
locations."/".return = "307 https://discord.gg/mkuKJkCuyM";
};
"compsoc.discord.skynet.ie" = {
forceSSL = true;
useACMEHost = "skynet";
locations."/".return = "307 https://discord.gg/mkuKJkCuyM";
};
"committee.discord.skynet.ie" = {
forceSSL = true;
useACMEHost = "skynet";
locations."/".return = "307 https://discord.gg/D6mbASJKxU";
};
"public.skynet.ie" = {
forceSSL = true;
useACMEHost = "skynet";
root = "${inputs.compsoc_public.packages.x86_64-linux.default}";
locations."/".extraConfig = "autoindex on;";
};
};
};
# Some old sites need a php pool running
services.phpfpm.pools.old_sites = {
user = "nobody";
settings = {
"pm" = "dynamic";
"listen.owner" = config.services.nginx.user;
"pm.max_children" = 5;
"pm.start_servers" = 2;
"pm.min_spare_servers" = 1;
"pm.max_spare_servers" = 3;
"pm.max_requests" = 500;
};
};
};
}