forked from mirrors/nixpkgs
774221191d
Pass through 'options' to exporter definitions and replace 'with lib;' by explicit function imports.
40 lines
880 B
Nix
40 lines
880 B
Nix
{ config, lib, pkgs, options }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.prometheus.exporters.fritzbox;
|
|
in
|
|
{
|
|
port = 9133;
|
|
extraOpts = {
|
|
gatewayAddress = mkOption {
|
|
type = types.str;
|
|
default = "fritz.box";
|
|
description = ''
|
|
The hostname or IP of the FRITZ!Box.
|
|
'';
|
|
};
|
|
|
|
gatewayPort = mkOption {
|
|
type = types.int;
|
|
default = 49000;
|
|
description = ''
|
|
The port of the FRITZ!Box UPnP service.
|
|
'';
|
|
};
|
|
};
|
|
serviceOpts = {
|
|
serviceConfig = {
|
|
DynamicUser = true;
|
|
ExecStart = ''
|
|
${pkgs.prometheus-fritzbox-exporter}/bin/exporter \
|
|
-listen-address ${cfg.listenAddress}:${toString cfg.port} \
|
|
-gateway-address ${cfg.gatewayAddress} \
|
|
-gateway-port ${toString cfg.gatewayPort} \
|
|
${concatStringsSep " \\\n " cfg.extraFlags}
|
|
'';
|
|
};
|
|
};
|
|
}
|