1{ config, lib, pkgs, options }: 2 3with lib; 4 5let 6 cfg = config.services.prometheus.exporters.v2ray; 7in 8{ 9 port = 9299; 10 extraOpts = { 11 v2rayEndpoint = mkOption { 12 type = types.str; 13 default = "127.0.0.1:54321"; 14 description = lib.mdDoc '' 15 v2ray grpc api endpoint 16 ''; 17 }; 18 }; 19 serviceOpts = { 20 serviceConfig = { 21 ExecStart = '' 22 ${pkgs.prometheus-v2ray-exporter}/bin/v2ray-exporter \ 23 --v2ray-endpoint ${cfg.v2rayEndpoint} \ 24 --listen ${cfg.listenAddress}:${toString cfg.port} \ 25 ${concatStringsSep " \\\n " cfg.extraFlags} 26 ''; 27 }; 28 }; 29}