Merge pull request #310348 from ehmry/nginx-validateConfigFile

nixos/nginx: add validateConfigFile option
This commit is contained in:
Pol Dellaiera 2024-05-12 21:58:59 +02:00 committed by GitHub
commit 378c5c67ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -142,7 +142,11 @@ let
default_type application/octet-stream; default_type application/octet-stream;
''; '';
configFile = pkgs.writers.writeNginxConfig "nginx.conf" '' configFile = (
if cfg.validateConfigFile
then pkgs.writers.writeNginxConfig
else pkgs.writeText
) "nginx.conf" ''
pid /run/nginx/nginx.pid; pid /run/nginx/nginx.pid;
error_log ${cfg.logError}; error_log ${cfg.logError};
daemon off; daemon off;
@ -1082,6 +1086,9 @@ in
''; '';
description = "Declarative vhost config"; description = "Declarative vhost config";
}; };
validateConfigFile = lib.mkEnableOption ''
Validate configuration with pkgs.writeNginxConfig.
'' // { default = true; };
}; };
}; };