ae359d1ef2
Fixes issues described in #208242 for this part of the nixpkgs tree. There are no behavioral changes in this, it only adjusts the code so that it is easier to understand.
43 lines
1012 B
Nix
43 lines
1012 B
Nix
{ config, lib, pkgs, options, ... }:
|
|
|
|
let
|
|
cfg = config.services.prometheus.exporters.dnsmasq;
|
|
inherit (lib)
|
|
mkOption
|
|
types
|
|
concatStringsSep
|
|
escapeShellArg
|
|
;
|
|
in
|
|
{
|
|
port = 9153;
|
|
extraOpts = {
|
|
dnsmasqListenAddress = mkOption {
|
|
type = types.str;
|
|
default = "localhost:53";
|
|
description = ''
|
|
Address on which dnsmasq listens.
|
|
'';
|
|
};
|
|
leasesPath = mkOption {
|
|
type = types.path;
|
|
default = "/var/lib/misc/dnsmasq.leases";
|
|
example = "/var/lib/dnsmasq/dnsmasq.leases";
|
|
description = ''
|
|
Path to the `dnsmasq.leases` file.
|
|
'';
|
|
};
|
|
};
|
|
serviceOpts = {
|
|
serviceConfig = {
|
|
ExecStart = ''
|
|
${pkgs.prometheus-dnsmasq-exporter}/bin/dnsmasq_exporter \
|
|
--listen ${cfg.listenAddress}:${toString cfg.port} \
|
|
--dnsmasq ${cfg.dnsmasqListenAddress} \
|
|
--leases_path ${escapeShellArg cfg.leasesPath} \
|
|
${concatStringsSep " \\\n " cfg.extraFlags}
|
|
'';
|
|
};
|
|
};
|
|
}
|