summary refs log tree commit diff
path: root/nixos/modules/services/monitoring
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2022-11-28 23:17:26 +0100
committerGitHub <noreply@github.com>2022-11-28 23:17:26 +0100
commit03b9249971d85ff3ed9a87cd1d5370a13b9053cb (patch)
treef11d446c2f9e84891612b156b1ed6491d4d720c3 /nixos/modules/services/monitoring
parent62e7f55dbb27e5e45211724624c7b43b2e84a507 (diff)
parent5ed08d83f71a7eea1963fb77f1f1f3092e3a001d (diff)
downloadnixpkgs-03b9249971d85ff3ed9a87cd1d5370a13b9053cb.tar
nixpkgs-03b9249971d85ff3ed9a87cd1d5370a13b9053cb.tar.gz
nixpkgs-03b9249971d85ff3ed9a87cd1d5370a13b9053cb.tar.bz2
nixpkgs-03b9249971d85ff3ed9a87cd1d5370a13b9053cb.tar.lz
nixpkgs-03b9249971d85ff3ed9a87cd1d5370a13b9053cb.tar.xz
nixpkgs-03b9249971d85ff3ed9a87cd1d5370a13b9053cb.tar.zst
nixpkgs-03b9249971d85ff3ed9a87cd1d5370a13b9053cb.zip
Merge pull request #202087 from Shawn8901/pve-load-credential
Diffstat (limited to 'nixos/modules/services/monitoring')
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/pve.nix8
1 files changed, 5 insertions, 3 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/pve.nix b/nixos/modules/services/monitoring/prometheus/exporters/pve.nix
index 8e2573d084b..e02acad3ecd 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/pve.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/pve.nix
@@ -10,7 +10,7 @@ let
     text = "default:";
   };
 
-  computedConfigFile = "${if cfg.configFile == null then emptyConfigFile else cfg.configFile}";
+  computedConfigFile = if cfg.configFile == null then emptyConfigFile else cfg.configFile;
 in
 {
   port = 9221;
@@ -100,6 +100,8 @@ in
   };
   serviceOpts = {
     serviceConfig = {
+      DynamicUser = cfg.environmentFile == null;
+      LoadCredential = "configFile:${computedConfigFile}";
       ExecStart = ''
         ${cfg.package}/bin/pve_exporter \
           --${if cfg.collectors.status == true then "" else "no-"}collector.status \
@@ -108,11 +110,11 @@ in
           --${if cfg.collectors.cluster == true then "" else "no-"}collector.cluster \
           --${if cfg.collectors.resources == true then "" else "no-"}collector.resources \
           --${if cfg.collectors.config == true then "" else "no-"}collector.config \
-          ${computedConfigFile} \
+          %d/configFile \
           ${toString cfg.port} ${cfg.listenAddress}
       '';
     } // optionalAttrs (cfg.environmentFile != null) {
-          EnvironmentFile = cfg.environmentFile;
+      EnvironmentFile = cfg.environmentFile;
     };
   };
 }