infrastructure/machines/web01/redirections.nix
Tom Hubrecht ade1358caa
All checks were successful
build configuration / build_storage01 (push) Successful in 50s
build configuration / build_compute01 (push) Successful in 1m28s
build configuration / build_web01 (push) Successful in 1m54s
feat(redirections): Add more retired services
2023-12-21 15:08:12 +01:00

52 lines
1.2 KiB
Nix

{ sources, ... }:
let
retired_host = "retired.dgnum.eu";
mkRetired = hosts:
builtins.listToAttrs (builtins.map (name: {
inherit name;
value.to = retired_host;
}) hosts);
mkSub = domain: builtins.map (s: "${s}.${domain}");
redirections = {
"nuage.beta.rz.ens.wtf".to = "cloud.dgnum.eu";
"notion.rz.ens.wtf".to = "docs.dgnum.eu";
"docs.beta.rz.ens.wtf".to = "pads.dgnum.eu";
"calendrier.eleves.ens.fr".to = "calendrier.dgnum.eu";
"git.rz.ens.wtf".to = "git.dgnum.eu";
} // (mkRetired retired);
retired = (mkSub "ens.fr" [ "alevins" "www.climatenavigator" ])
++ (mkSub "rz.ens.wtf" [ "s3" "cdn" ]) ++ (mkSub "beta.rz.ens.wtf" [
"todo"
"minecraft"
"factorio"
"home"
"pads"
"api.pads"
"files.pads"
"sandbox.pads"
"jurisprudens"
"rstudio"
]);
in {
services.nginx.virtualHosts = {
${retired_host} = {
enableACME = true;
forceSSL = true;
root = "${sources.dgnum-retired.outPath}/www";
default = true;
};
} // (builtins.mapAttrs (host:
{ to, ssl ? true }: {
globalRedirect = to;
enableACME = ssl;
forceSSL = ssl;
}) redirections);
}