1{ config, lib, pkgs }: 2 3with lib; 4 5let 6 cfg = config.services.prometheus.exporters.fritzbox; 7in 8{ 9 port = 9133; 10 extraOpts = { 11 gatewayAddress = mkOption { 12 type = types.str; 13 default = "fritz.box"; 14 description = '' 15 The hostname or IP of the FRITZ!Box. 16 ''; 17 }; 18 19 gatewayPort = mkOption { 20 type = types.int; 21 default = 49000; 22 description = '' 23 The port of the FRITZ!Box UPnP service. 24 ''; 25 }; 26 }; 27 serviceOpts = { 28 serviceConfig = { 29 DynamicUser = true; 30 ExecStart = '' 31 ${pkgs.prometheus-fritzbox-exporter}/bin/fritzbox_exporter \ 32 -listen-address ${cfg.listenAddress}:${toString cfg.port} \ 33 -gateway-address ${cfg.gatewayAddress} \ 34 -gateway-port ${toString cfg.gatewayPort} \ 35 ${concatStringsSep " \\\n " cfg.extraFlags} 36 ''; 37 }; 38 }; 39}