diff options
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/monitoring/loki.nix | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nixos/modules/services/monitoring/loki.nix b/nixos/modules/services/monitoring/loki.nix index ba63f95e7f1a8..a53830fd64c80 100644 --- a/nixos/modules/services/monitoring/loki.nix +++ b/nixos/modules/services/monitoring/loki.nix @@ -99,9 +99,16 @@ in { conf = if cfg.configFile == null then prettyJSON cfg.configuration else cfg.configFile; + validateConfig = file: + pkgs.runCommand "validate-loki-conf" { + nativeBuildInputs = [ pkgs.grafana-loki ]; + } '' + loki -verify-config -config.file "${file}" + ln -s "${file}" "$out" + ''; in { - ExecStart = "${cfg.package}/bin/loki --config.file=${conf} ${escapeShellArgs cfg.extraFlags}"; + ExecStart = "${cfg.package}/bin/loki --config.file=${validateConfig conf} ${escapeShellArgs cfg.extraFlags}"; User = cfg.user; Restart = "always"; PrivateTmp = true; |