1{ config, lib, pkgs, options }: 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 = lib.mdDoc '' 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 ExecStart = '' 24 ${pkgs.prometheus-surfboard-exporter}/bin/surfboard_exporter \ 25 --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \ 26 --modem-address ${cfg.modemAddress} \ 27 ${concatStringsSep " \\\n " cfg.extraFlags} 28 ''; 29 }; 30 }; 31}