diff --git a/nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix b/nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix
index c5b84e574b8d..eae7a61297d1 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix
@@ -23,12 +23,24 @@ in {
to set the peers up.
'';
};
+
+ singleSubnetPerField = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ By default, all allowed IPs and subnets are comma-separated in the
+ allowed_ips field. With this option enabled,
+ a single IP and subnet will be listed in fields like allowed_ip_0,
+ allowed_ip_1 and so on.
+ '';
+ };
};
serviceOpts = {
script = ''
${pkgs.prometheus-wireguard-exporter}/bin/prometheus_wireguard_exporter \
-p ${toString cfg.port} \
${optionalString cfg.verbose "-v"} \
+ ${optionalString cfg.singleSubnetPerField "-s"} \
${optionalString (cfg.wireguardConfig != null) "-n ${cfg.wireguardConfig}"}
'';