1{ config, lib, pkgs, options }:
2
3with lib;
4
5let
6 cfg = config.services.prometheus.exporters.modemmanager;
7in
8{
9 port = 9539;
10 extraOpts = {
11 refreshRate = mkOption {
12 type = types.str;
13 default = "5s";
14 description = ''
15 How frequently ModemManager will refresh the extended signal quality
16 information for each modem. The duration should be specified in seconds
17 ("5s"), minutes ("1m"), or hours ("1h").
18 '';
19 };
20 };
21 serviceOpts = {
22 serviceConfig = {
23 # Required in order to authenticate with ModemManager via D-Bus.
24 SupplementaryGroups = "networkmanager";
25 ExecStart = ''
26 ${pkgs.prometheus-modemmanager-exporter}/bin/modemmanager_exporter \
27 -addr ${cfg.listenAddress}:${toString cfg.port} \
28 -rate ${cfg.refreshRate} \
29 ${concatStringsSep " \\\n " cfg.extraFlags}
30 '';
31 };
32 };
33}