1 { config, lib, pkgs, options, ... }:
4 cfg = config.services.prometheus.exporters.py-air-control;
5 inherit (lib) mkOption types;
7 workingDir = "/var/lib/${cfg.stateDir}";
13 deviceHostname = mkOption {
15 example = "192.168.1.123";
17 The hostname of the air purification device from which to scrape the metrics.
24 The protocol to use when communicating with the air purification device.
25 Available: [http, coap, plain_coap]
30 default = "prometheus-py-air-control-exporter";
32 Directory below `/var/lib` to store runtime data.
33 This directory will be created automatically using systemd's StateDirectory mechanism.
40 StateDirectory = cfg.stateDir;
41 WorkingDirectory = workingDir;
43 ${pkgs.python3Packages.py-air-control-exporter}/bin/py-air-control-exporter \
44 --host ${cfg.deviceHostname} \
45 --protocol ${cfg.protocol} \
46 --listen-port ${toString cfg.port} \
47 --listen-address ${cfg.listenAddress}
49 Environment = [ "HOME=${workingDir}" ];