1{ 2 config, 3 lib, 4 pkgs, 5 options, 6 ... 7}: 8 9let 10 cfg = config.services.prometheus.exporters.dnsmasq; 11 inherit (lib) 12 mkOption 13 types 14 concatStringsSep 15 escapeShellArg 16 ; 17in 18{ 19 port = 9153; 20 extraOpts = { 21 dnsmasqListenAddress = mkOption { 22 type = types.str; 23 default = "localhost:53"; 24 description = '' 25 Address on which dnsmasq listens. 26 ''; 27 }; 28 leasesPath = mkOption { 29 type = types.path; 30 default = "/var/lib/dnsmasq/dnsmasq.leases"; 31 example = "/var/lib/misc/dnsmasq.leases"; 32 description = '' 33 Path to the `dnsmasq.leases` file. 34 ''; 35 }; 36 }; 37 serviceOpts = { 38 serviceConfig = { 39 ExecStart = '' 40 ${pkgs.prometheus-dnsmasq-exporter}/bin/dnsmasq_exporter \ 41 --listen ${cfg.listenAddress}:${toString cfg.port} \ 42 --dnsmasq ${cfg.dnsmasqListenAddress} \ 43 --leases_path ${escapeShellArg cfg.leasesPath} \ 44 ${concatStringsSep " \\\n " cfg.extraFlags} 45 ''; 46 }; 47 }; 48}