diff --git a/machines/web01/metis/default.nix b/machines/web01/metis/default.nix index 949fa6a..3f2cb14 100644 --- a/machines/web01/metis/default.nix +++ b/machines/web01/metis/default.nix @@ -6,30 +6,35 @@ }: let - metis = import sources.metis { inherit pkgs; }; + inherit (lib) mapAttrsToList match; - inherit (metis) providers; + metis = import sources.metis { inherit pkgs; }; in { services.nginx.virtualHosts."calendrier.dgnum.eu" = { enableACME = true; forceSSL = true; - root = metis.production; + root = metis.package; locations = lib.mapAttrs' ( - name: value: + 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 ${value}; + proxy_pass https://${domain}/remote.php/dav/public-calendars/; ''; } - ) providers; + ) 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; } diff --git a/npins/sources.json b/npins/sources.json index bdad599..b2feca3 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -178,9 +178,9 @@ "url": "https://git.dgnum.eu/DGNum/metis" }, "branch": "master", - "revision": "5c5e0c356bc60c15699a0830ef675af821afbb5b", + "revision": "ed6fafda45d638b1bafd5deaee098b80156b41e8", "url": null, - "hash": "0lijsmgcqqqrdi2qdycwsaczcjja5blvx4kx1ssclvsm8aipbbs0" + "hash": "086spyhn2x1x2h31b0y4an501fdhph1nk64riybqnh6mqjkzlq4m" }, "microvm.nix": { "type": "Git",