diff --git a/nixos/modules/services/databases/victoriametrics.nix b/nixos/modules/services/databases/victoriametrics.nix index e22b85371c3a..b606d574b5d3 100644 --- a/nixos/modules/services/databases/victoriametrics.nix +++ b/nixos/modules/services/databases/victoriametrics.nix @@ -24,10 +24,13 @@ let checkedConfig = file: - pkgs.runCommand "checked-config" { nativeBuildInputs = [ cfg.package ]; } '' - ln -s ${file} $out - ${lib.escapeShellArgs startCLIList} -promscrape.config=${file} -dryRun - ''; + if cfg.checkConfig then + pkgs.runCommand "checked-config" { nativeBuildInputs = [ cfg.package ]; } '' + ln -s ${file} $out + ${lib.escapeShellArgs startCLIList} -promscrape.config=${file} -dryRun + '' + else + file; in { options.services.victoriametrics = { @@ -127,6 +130,17 @@ in or {command}`victoriametrics -help` for more information. ''; }; + + checkConfig = lib.mkOption { + type = lib.types.bool; + default = true; + description = '' + Check configuration. + + If you use credentials stored in external files (`environmentFile`, etc), + they will not be visible and it will report errors, despite a correct configuration. + ''; + }; }; config = lib.mkIf cfg.enable { diff --git a/nixos/modules/services/monitoring/vmagent.nix b/nixos/modules/services/monitoring/vmagent.nix index db65e72cefff..cce800c6c751 100644 --- a/nixos/modules/services/monitoring/vmagent.nix +++ b/nixos/modules/services/monitoring/vmagent.nix @@ -30,10 +30,13 @@ let checkedConfig = file: - pkgs.runCommand "checked-config" { nativeBuildInputs = [ cfg.package ]; } '' - ln -s ${file} $out - ${lib.escapeShellArgs startCLIList} -promscrape.config=${file} -dryRun - ''; + if cfg.checkConfig then + pkgs.runCommand "checked-config" { nativeBuildInputs = [ cfg.package ]; } '' + ln -s ${file} $out + ${lib.escapeShellArgs startCLIList} -promscrape.config=${file} -dryRun + '' + else + file; in { imports = [ @@ -119,6 +122,17 @@ in or {command}`vmagent -help` for more information. ''; }; + + checkConfig = lib.mkOption { + type = lib.types.bool; + default = true; + description = '' + Check configuration. + + If you use credentials stored in external files (`environmentFile`, etc), + they will not be visible and it will report errors, despite a correct configuration. + ''; + }; }; config = lib.mkIf cfg.enable {