diff --git a/nixos/modules/services/monitoring/prometheus/default.nix b/nixos/modules/services/monitoring/prometheus/default.nix index d7e06484b69289..bfd4951ef48adc 100644 --- a/nixos/modules/services/monitoring/prometheus/default.nix +++ b/nixos/modules/services/monitoring/prometheus/default.nix @@ -629,7 +629,9 @@ in { config = mkIf cfg.enable { assertions = [ ( let - legacy = builtins.match "(.*):(.*)" cfg.listenAddress; + # Match something with dots (an IPv4 address) or something ending in + # a square bracket (an IPv6 addresses) followed by a port number. + legacy = builtins.match "(.*\\..*|.*]):([[:digit:]]+)" cfg.listenAddress; in { assertion = legacy == null; message = ''