diff --git a/machines/web01/metis/default.nix b/machines/web01/metis/default.nix index 1517bb9..286ec4c 100644 --- a/machines/web01/metis/default.nix +++ b/machines/web01/metis/default.nix @@ -2,19 +2,13 @@ let metis = import sources.metis { inherit pkgs; }; - package = metis.production; + inherit (metis) providers; - - - in { services.nginx.virtualHosts."calendrier.dgnum.eu" = { - serverAliases = [ - "calendrier.eleves.ens.fr" - ]; enableACME = true; forceSSL = true; - root = package; + root = metis.production; locations = lib.mapAttrs' (name: value: lib.nameValuePair "/cal/${name}/" { @@ -23,7 +17,7 @@ in { proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass ${value}; - ''; + ''; }) providers; extraConfig = '' diff --git a/machines/web01/redirections.nix b/machines/web01/redirections.nix index ffc4fdd..ddc4428 100644 --- a/machines/web01/redirections.nix +++ b/machines/web01/redirections.nix @@ -4,12 +4,16 @@ let retired_host = "retired.dgnum.eu"; redirections = { - "nuage.beta.rz.ens.wtf" = "cloud.dgnum.eu"; - "notion.rz.ens.wtf" = "docs.dgnum.eu"; - "docs.beta.rz.ens.wtf" = "pads.dgnum.eu"; + "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"; + ssl = true; + }; } // (builtins.listToAttrs (builtins.map (name: { inherit name; - value = retired_host; + value.to = retired_host; }) retired)); retired = [ "auth.rz.ens.wtf" "photos.ens.wtf" ]; @@ -22,5 +26,10 @@ in { root = "${sources.dgnum-retired.outPath}/www"; }; - } // (builtins.mapAttrs (host: to: { globalRedirect = to; }) redirections); + } // (builtins.mapAttrs (host: + { to, ssl ? false }: { + globalRedirect = to; + enableACME = ssl; + forceSSL = ssl; + }) redirections); }