Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
59 lines
1.4 KiB
Nix
59 lines
1.4 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
options,
|
|
...
|
|
}:
|
|
|
|
let
|
|
cfg = config.services.prometheus.exporters.py-air-control;
|
|
inherit (lib) mkOption types;
|
|
|
|
workingDir = "/var/lib/${cfg.stateDir}";
|
|
|
|
in
|
|
{
|
|
port = 9896;
|
|
extraOpts = {
|
|
deviceHostname = mkOption {
|
|
type = types.str;
|
|
example = "192.168.1.123";
|
|
description = ''
|
|
The hostname of the air purification device from which to scrape the metrics.
|
|
'';
|
|
};
|
|
protocol = mkOption {
|
|
type = types.str;
|
|
default = "http";
|
|
description = ''
|
|
The protocol to use when communicating with the air purification device.
|
|
Available: [http, coap, plain_coap]
|
|
'';
|
|
};
|
|
stateDir = mkOption {
|
|
type = types.str;
|
|
default = "prometheus-py-air-control-exporter";
|
|
description = ''
|
|
Directory below `/var/lib` to store runtime data.
|
|
This directory will be created automatically using systemd's StateDirectory mechanism.
|
|
'';
|
|
};
|
|
};
|
|
serviceOpts = {
|
|
serviceConfig = {
|
|
DynamicUser = false;
|
|
StateDirectory = cfg.stateDir;
|
|
WorkingDirectory = workingDir;
|
|
ExecStart = ''
|
|
${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 = [ "HOME=${workingDir}" ];
|
|
};
|
|
};
|
|
}
|