{ config, lib, pkgs, options, ... }:

let
  cfg = config.services.prometheus.exporters.statsd;
  inherit (lib) concatStringsSep;
in
{
  port = 9102;
  serviceOpts = {
    serviceConfig = {
      ExecStart = ''
        ${pkgs.prometheus-statsd-exporter}/bin/statsd_exporter \
          --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
          ${concatStringsSep " \\\n  " cfg.extraFlags}
      '';
    };
  };
}
