3
0
Fork 0
forked from mirrors/nixpkgs

nixos/varnish: add enableConfigCheck

This commit is contained in:
ajs124 2021-10-06 22:00:36 +02:00
parent 1d5953184a
commit e3ac5e1502

View file

@ -13,6 +13,8 @@ in
services.varnish = {
enable = mkEnableOption "Varnish Server";
enableConfigCheck = mkEnableOption "checking the config during build time" // { default = true; };
package = mkOption {
type = types.package;
default = pkgs.varnish;
@ -96,11 +98,10 @@ in
environment.systemPackages = [ cfg.package ];
# check .vcl syntax at compile time (e.g. before nixops deployment)
system.extraDependencies = [
(pkgs.stdenv.mkDerivation {
name = "check-varnish-syntax";
buildCommand = "${cfg.package}/sbin/varnishd -C ${commandLine} 2> $out || (cat $out; exit 1)";
})
system.extraDependencies = mkIf cfg.enableConfigCheck [
(pkgs.runCommand "check-varnish-syntax" {} ''
${cfg.package}/bin/varnishd -C ${commandLine} 2> $out || (cat $out; exit 1)
'')
];
users.users.varnish = {