nginx: soften assertion

This commit is contained in:
Sandro - 2024-04-26 10:02:28 +02:00
parent 996fc4c9e2
commit 5f4f228708
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
1 changed files with 1 additions and 1 deletions

View File

@ -90,7 +90,7 @@ in
config = lib.mkIf cfg.enable {
assertions = lib.mkIf cfg.setHSTSHeader (lib.attrValues (lib.mapAttrs (host: hostConfig: {
assertion = hostConfig.root == null;
assertion = (lib.length (lib.attrNames hostConfig.locations)) == 0 -> hostConfig.root == null;
message = let
name = ''services.nginx.virtualHosts."${host}"'';
in "Use ${name}.locations./.root instead of ${name}.root to properly apply .locations.*.extraConfig set by services.nginx.setHSTSHeader";