1{ config, lib, pkgs }: 2 3with lib; 4 5let 6 cfg = config.services.prometheus.exporters.surfboard; 7in 8{ 9 port = 9239; 10 extraOpts = { 11 modemAddress = mkOption { 12 type = types.str; 13 default = "192.168.100.1"; 14 description = '' 15 The hostname or IP of the cable modem. 16 ''; 17 }; 18 }; 19 serviceOpts = { 20 description = "Prometheus exporter for surfboard cable modem"; 21 unitConfig.Documentation = "https://github.com/ipstatic/surfboard_exporter"; 22 serviceConfig = { 23 DynamicUser = true; 24 ExecStart = '' 25 ${pkgs.prometheus-surfboard-exporter}/bin/surfboard_exporter \ 26 --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \ 27 --modem-address ${cfg.modemAddress} \ 28 ${concatStringsSep " \\\n " cfg.extraFlags} 29 ''; 30 }; 31 }; 32}