mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
Merge pull request #106788 from urbas/py-air-control-exporter-cli
nixos/prometheus-exporters/py-air-control: invoke exporter command
This commit is contained in:
commit
8727a0178f
1 changed files with 6 additions and 15 deletions
|
@ -5,10 +5,6 @@ with lib;
|
||||||
let
|
let
|
||||||
cfg = config.services.prometheus.exporters.py-air-control;
|
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}";
|
workingDir = "/var/lib/${cfg.stateDir}";
|
||||||
|
|
||||||
in
|
in
|
||||||
|
@ -45,18 +41,13 @@ in
|
||||||
StateDirectory = cfg.stateDir;
|
StateDirectory = cfg.stateDir;
|
||||||
WorkingDirectory = workingDir;
|
WorkingDirectory = workingDir;
|
||||||
ExecStart = ''
|
ExecStart = ''
|
||||||
${py-air-control-exporter-env}/bin/python -c \
|
${pkgs.python3Packages.py-air-control-exporter}/bin/py-air-control-exporter \
|
||||||
"from py_air_control_exporter import app; app.create_app().run( \
|
--host ${cfg.deviceHostname} \
|
||||||
debug=False, \
|
--protocol ${cfg.protocol} \
|
||||||
port=${toString cfg.port}, \
|
--listen-port ${toString cfg.port} \
|
||||||
host='${cfg.listenAddress}', \
|
--listen-address ${cfg.listenAddress}
|
||||||
)"
|
|
||||||
'';
|
'';
|
||||||
Environment = [
|
Environment = [ "HOME=${workingDir}" ];
|
||||||
"PY_AIR_CONTROL_HOST=${cfg.deviceHostname}"
|
|
||||||
"PY_AIR_CONTROL_PROTOCOL=${cfg.protocol}"
|
|
||||||
"HOME=${workingDir}"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue