2024-04-20 14:37:31 +02:00
|
|
|
{ lib, config, ... }:
|
2023-12-18 23:16:07 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
retired_host = "retired.dgnum.eu";
|
|
|
|
|
2024-02-02 10:51:31 +01:00
|
|
|
mkRetired =
|
|
|
|
hosts:
|
|
|
|
builtins.listToAttrs (
|
2024-03-10 01:03:30 +01:00
|
|
|
builtins.map (name: {
|
|
|
|
inherit name;
|
|
|
|
value = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
locations."/".return = "301 https://${retired_host}/${name}";
|
|
|
|
};
|
|
|
|
}) hosts
|
2024-02-02 10:51:31 +01:00
|
|
|
);
|
2023-12-21 15:08:12 +01:00
|
|
|
|
|
|
|
mkSub = domain: builtins.map (s: "${s}.${domain}");
|
2024-02-02 10:51:31 +01:00
|
|
|
mkSubs = attrs: builtins.concatLists (builtins.attrValues (builtins.mapAttrs mkSub attrs));
|
2023-12-21 15:08:12 +01:00
|
|
|
|
2024-02-14 11:15:46 +01:00
|
|
|
mkRedirection =
|
|
|
|
_:
|
|
|
|
{ to }:
|
|
|
|
{
|
|
|
|
globalRedirect = to;
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
};
|
|
|
|
|
2024-04-20 14:37:31 +02:00
|
|
|
cfg = config.dgn-redirections;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.dgn-redirections = {
|
|
|
|
redirections = lib.mkOption {
|
|
|
|
type =
|
|
|
|
with lib.types;
|
|
|
|
attrsOf (submodule {
|
|
|
|
options.to = lib.mkOption { type = str; };
|
|
|
|
});
|
|
|
|
default = { };
|
|
|
|
};
|
|
|
|
retired = lib.mkOption {
|
|
|
|
type = with lib.types; listOf str;
|
|
|
|
default = [ ];
|
|
|
|
};
|
2024-02-14 11:15:46 +01:00
|
|
|
};
|
2024-04-20 14:37:31 +02:00
|
|
|
config = {
|
|
|
|
dgn-redirections = {
|
|
|
|
redirections = {
|
|
|
|
"calendrier.eleves.ens.fr".to = "calendrier.dgnum.eu";
|
|
|
|
"docs.beta.rz.ens.wtf".to = "pads.dgnum.eu";
|
|
|
|
"git.rz.ens.wtf".to = "git.dgnum.eu";
|
|
|
|
"notion.rz.ens.wtf".to = "docs.dgnum.eu";
|
|
|
|
"nuage.beta.rz.ens.wtf".to = "cloud.dgnum.eu";
|
|
|
|
"rdv.dgnum.eu".to = "meet.dgnum.eu";
|
|
|
|
"www.bda.ens.fr".to = "bda.ens.fr";
|
|
|
|
"bda.wp.dgnum.eu".to = "bda.ens.fr";
|
|
|
|
"www.tuteurs.ens.fr".to = "tuteurs.ens.fr";
|
|
|
|
"www.interq.ens.fr".to = "interq.ens.fr";
|
|
|
|
"www.lanuit.ens.fr".to = "lanuit.ens.fr";
|
|
|
|
};
|
2023-12-18 23:16:07 +01:00
|
|
|
|
2024-04-20 14:37:31 +02:00
|
|
|
retired = mkSubs {
|
|
|
|
"ens.fr" = [
|
|
|
|
"alevins"
|
|
|
|
"www.climatenavigator"
|
|
|
|
];
|
|
|
|
"ens.wtf" = [ "photos" ];
|
|
|
|
"rz.ens.wtf" = [
|
|
|
|
"s3"
|
|
|
|
"cdn"
|
|
|
|
];
|
|
|
|
"beta.rz.ens.wtf" = [
|
|
|
|
"todo"
|
|
|
|
"minecraft"
|
|
|
|
"factorio"
|
|
|
|
"home"
|
|
|
|
"pads"
|
|
|
|
"api.pads"
|
|
|
|
"files.pads"
|
|
|
|
"sandbox.pads"
|
|
|
|
"jurisprudens"
|
|
|
|
"rstudio"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
services.nginx.virtualHosts = {
|
|
|
|
${retired_host}.default = true;
|
|
|
|
} // (builtins.mapAttrs mkRedirection cfg.redirections) // (mkRetired cfg.retired);
|
2023-12-21 15:11:33 +01:00
|
|
|
};
|
2023-12-18 23:16:07 +01:00
|
|
|
}
|