summary refs log tree commit diff
path: root/nixos/modules/services/monitoring/prometheus/exporters/py-air-control.nix
diff options
context:
space:
mode:
authorMatej Urbas <matej.urbas@gmail.com>2020-12-07 12:15:38 +0000
committerMatej Urbas <matej.urbas@gmail.com>2020-12-12 20:19:54 +0000
commit4970fbedbcab6f7a9d4030952c0a01c33b0f4e97 (patch)
tree1e42ac09b1a836282326c5f62f5cc26969559cef /nixos/modules/services/monitoring/prometheus/exporters/py-air-control.nix
parent2c0f6135aab77ff942b615228882c7dd996e0882 (diff)
downloadnixpkgs-4970fbedbcab6f7a9d4030952c0a01c33b0f4e97.tar
nixpkgs-4970fbedbcab6f7a9d4030952c0a01c33b0f4e97.tar.gz
nixpkgs-4970fbedbcab6f7a9d4030952c0a01c33b0f4e97.tar.bz2
nixpkgs-4970fbedbcab6f7a9d4030952c0a01c33b0f4e97.tar.lz
nixpkgs-4970fbedbcab6f7a9d4030952c0a01c33b0f4e97.tar.xz
nixpkgs-4970fbedbcab6f7a9d4030952c0a01c33b0f4e97.tar.zst
nixpkgs-4970fbedbcab6f7a9d4030952c0a01c33b0f4e97.zip
nixos/prometheus-exporters/py-air-control: invoke exporter command
Package `py-air-control exporter` v0.1.5 comes with a new CLI. This change uses the new CLI (which simplifies the exporter's systemd service setup).
Diffstat (limited to 'nixos/modules/services/monitoring/prometheus/exporters/py-air-control.nix')
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/py-air-control.nix21
1 files changed, 6 insertions, 15 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/py-air-control.nix b/nixos/modules/services/monitoring/prometheus/exporters/py-air-control.nix
index d9a627ca2ea..d9ab99221d9 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/py-air-control.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/py-air-control.nix
@@ -5,10 +5,6 @@ with lib;
 let
   cfg = config.services.prometheus.exporters.py-air-control;
 
-  py-air-control-exporter-env = pkgs.python3.withPackages (pyPkgs: [
-      pyPkgs.py-air-control-exporter
-  ]);
-
   workingDir = "/var/lib/${cfg.stateDir}";
 
 in
@@ -45,18 +41,13 @@ in
       StateDirectory = cfg.stateDir;
       WorkingDirectory = workingDir;
       ExecStart = ''
-        ${py-air-control-exporter-env}/bin/python -c \
-          "from py_air_control_exporter import app; app.create_app().run( \
-              debug=False, \
-              port=${toString cfg.port}, \
-              host='${cfg.listenAddress}', \
-          )"
+        ${pkgs.python3Packages.py-air-control-exporter}/bin/py-air-control-exporter \
+          --host ${cfg.deviceHostname} \
+          --protocol ${cfg.protocol} \
+          --listen-port ${toString cfg.port} \
+          --listen-address ${cfg.listenAddress}
       '';
-      Environment = [
-        "PY_AIR_CONTROL_HOST=${cfg.deviceHostname}"
-        "PY_AIR_CONTROL_PROTOCOL=${cfg.protocol}"
-        "HOME=${workingDir}"
-      ];
+      Environment = [ "HOME=${workingDir}" ];
     };
   };
 }