forked from DGNum/infrastructure
Tom Hubrecht
88d9b8c3e3
Signed-off-by: Tom Hubrecht <tom.hubrecht@dgnum.eu> Acked-by: Ryan Lahfa <ryan.lahfa@dgnum.eu> Acked-by: Maurice Debray <maurice.debray@dgnum.eu> Acked-by: Lubin Bailly <lubin.bailly@dgnum.eu> Acked-by: Jean-Marc Gailis <jean-marc.gailis@dgnum.eu> as the legal authority, at the time of writing, in DGNum. Acked-by: Elias Coppens <elias.coppens@dgnum.eu> as a member, at the time of writing, of the DGNum executive counsel.
45 lines
1.2 KiB
Nix
45 lines
1.2 KiB
Nix
# SPDX-FileCopyrightText: 2024 Tom Hubrecht <tom.hubrecht@dgnum.eu>
|
|
# SPDX-FileContributor: Maurice Debray <maurice.debray@dgnum.eu>
|
|
#
|
|
# SPDX-License-Identifier: EUPL-1.2
|
|
|
|
{
|
|
lib,
|
|
pkgs,
|
|
sources,
|
|
...
|
|
}:
|
|
|
|
let
|
|
inherit (lib) mapAttrsToList match;
|
|
|
|
metis = import sources.metis { inherit pkgs; };
|
|
in
|
|
{
|
|
services.nginx.virtualHosts."calendrier.dgnum.eu" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
root = metis.package;
|
|
|
|
locations = lib.mapAttrs' (
|
|
name: domain:
|
|
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;
|
|
proxy_pass https://${domain}/remote.php/dav/public-calendars/;
|
|
'';
|
|
}
|
|
) metis.providers;
|
|
|
|
extraConfig = ''
|
|
rewrite ^/calendrier(.*)$ $1 permanent;
|
|
'';
|
|
};
|
|
|
|
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;
|
|
}
|