mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-21 20:49:52 +03:00
Merge pull request #140799 from helsinki-systems/feat/varnish-optional-configcheck
nixos/varnish: add enableConfigCheck
This commit is contained in:
commit
36187264df
@ -13,6 +13,8 @@ in
|
|||||||
services.varnish = {
|
services.varnish = {
|
||||||
enable = mkEnableOption "Varnish Server";
|
enable = mkEnableOption "Varnish Server";
|
||||||
|
|
||||||
|
enableConfigCheck = mkEnableOption "checking the config during build time" // { default = true; };
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = pkgs.varnish;
|
default = pkgs.varnish;
|
||||||
@ -96,11 +98,10 @@ in
|
|||||||
environment.systemPackages = [ cfg.package ];
|
environment.systemPackages = [ cfg.package ];
|
||||||
|
|
||||||
# check .vcl syntax at compile time (e.g. before nixops deployment)
|
# check .vcl syntax at compile time (e.g. before nixops deployment)
|
||||||
system.extraDependencies = [
|
system.extraDependencies = mkIf cfg.enableConfigCheck [
|
||||||
(pkgs.stdenv.mkDerivation {
|
(pkgs.runCommand "check-varnish-syntax" {} ''
|
||||||
name = "check-varnish-syntax";
|
${cfg.package}/bin/varnishd -C ${commandLine} 2> $out || (cat $out; exit 1)
|
||||||
buildCommand = "${cfg.package}/sbin/varnishd -C ${commandLine} 2> $out || (cat $out; exit 1)";
|
'')
|
||||||
})
|
|
||||||
];
|
];
|
||||||
|
|
||||||
users.users.varnish = {
|
users.users.varnish = {
|
||||||
|
Loading…
Reference in New Issue
Block a user