infrastructure/machines/web01/redirections.nix
sinavir 20d3354a4d
All checks were successful
Check meta / check_meta (push) Successful in 24s
Check meta / check_meta (pull_request) Successful in 26s
Check meta / check_dns (push) Successful in 52s
Check meta / check_dns (pull_request) Successful in 53s
build configuration / build_vault01 (pull_request) Successful in 59s
build configuration / build_storage01 (pull_request) Successful in 1m9s
build configuration / build_compute01 (pull_request) Successful in 1m16s
build configuration / build_web02 (pull_request) Successful in 57s
build configuration / build_web01 (pull_request) Successful in 1m39s
build configuration / build_rescue01 (pull_request) Successful in 1m1s
build configuration / push_to_cache (pull_request) Successful in 2m42s
build configuration / build_vault01 (push) Successful in 1m9s
build configuration / build_storage01 (push) Successful in 1m10s
build configuration / build_compute01 (push) Successful in 1m16s
build configuration / build_web02 (push) Successful in 53s
build configuration / build_rescue01 (push) Successful in 57s
lint / check (push) Successful in 25s
build configuration / build_web01 (push) Successful in 1m35s
build configuration / push_to_cache (push) Successful in 2m12s
feat: declarative probes for uptime-kuma
2024-04-21 22:45:52 +02:00

92 lines
2.2 KiB
Nix

{ lib, config, ... }:
let
retired_host = "retired.dgnum.eu";
mkRetired =
hosts:
builtins.listToAttrs (
builtins.map (name: {
inherit name;
value = {
enableACME = true;
forceSSL = true;
locations."/".return = "301 https://${retired_host}/${name}";
};
}) hosts
);
mkSub = domain: builtins.map (s: "${s}.${domain}");
mkSubs = attrs: builtins.concatLists (builtins.attrValues (builtins.mapAttrs mkSub attrs));
mkRedirection =
_:
{ to }:
{
globalRedirect = to;
enableACME = true;
forceSSL = true;
};
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 = [ ];
};
};
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";
};
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);
};
}