2024-02-02 10:51:31 +01:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
sources,
|
|
|
|
...
|
|
|
|
}:
|
2023-09-25 00:40:47 +02:00
|
|
|
|
|
|
|
let
|
2024-10-24 00:27:15 +02:00
|
|
|
inherit (lib) mapAttrsToList match;
|
2023-10-02 21:32:54 +02:00
|
|
|
|
2024-10-24 00:27:15 +02:00
|
|
|
metis = import sources.metis { inherit pkgs; };
|
2024-02-02 10:51:31 +01:00
|
|
|
in
|
|
|
|
{
|
2023-10-02 21:32:54 +02:00
|
|
|
services.nginx.virtualHosts."calendrier.dgnum.eu" = {
|
2023-09-25 00:40:47 +02:00
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
2024-10-24 00:27:15 +02:00
|
|
|
root = metis.package;
|
2023-09-25 00:40:47 +02:00
|
|
|
|
2024-03-10 01:03:30 +01:00
|
|
|
locations = lib.mapAttrs' (
|
2024-10-24 00:27:15 +02:00
|
|
|
name: domain:
|
2024-03-10 01:03:30 +01:00
|
|
|
lib.nameValuePair "/cal/${name}/" {
|
|
|
|
extraConfig = ''
|
|
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
|
|
proxy_set_header X-Forwarded-Server $host;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
2024-10-24 00:27:15 +02:00
|
|
|
proxy_pass https://${domain}/remote.php/dav/public-calendars/;
|
2024-03-10 01:03:30 +01:00
|
|
|
'';
|
|
|
|
}
|
2024-10-24 00:27:15 +02:00
|
|
|
) metis.providers;
|
2023-10-01 22:50:15 +02:00
|
|
|
|
|
|
|
extraConfig = ''
|
|
|
|
rewrite ^/calendrier(.*)$ $1 permanent;
|
|
|
|
'';
|
2023-09-25 00:40:47 +02:00
|
|
|
};
|
2024-10-24 00:27:15 +02:00
|
|
|
|
|
|
|
assertions = mapAttrsToList (name: domain: {
|
|
|
|
assertion = (match "[a-z-]+" name == [ ]) && (match "[a-z.-]+" domain == [ ]);
|
|
|
|
message = "The provider `${name}` associated to the domain `${domain}` seems to have an incorrect definition.";
|
|
|
|
}) metis.providers;
|
2023-09-25 00:40:47 +02:00
|
|
|
}
|