prometheus: Use yaml format generator instaed json for prometheus.yml

Additionally remove an unused variable
This commit is contained in:
Shawn8901 2022-11-19 23:56:43 +01:00
parent 7634c3250b
commit 470247d433

View file

@ -3,7 +3,7 @@
with lib;
let
json = pkgs.formats.json { };
yaml = pkgs.formats.yaml { };
cfg = config.services.prometheus;
checkConfigEnabled =
(lib.isBool cfg.checkConfig && cfg.checkConfig)
@ -11,8 +11,6 @@ let
workingDir = "/var/lib/" + cfg.stateDir;
prometheusYmlOut = "${workingDir}/prometheus-substituted.yaml";
triggerReload = pkgs.writeShellScriptBin "trigger-reload-prometheus" ''
PATH="${makeBinPath (with pkgs; [ systemd ])}"
if systemctl -q is-active prometheus.service; then
@ -38,7 +36,7 @@ let
promtool ${what} $out
'' else file;
generatedPrometheusYml = json.generate "prometheus.yml" promConfig;
generatedPrometheusYml = yaml.generate "prometheus.yml" promConfig;
# This becomes the main config file for Prometheus
promConfig = {