nixos/kresd: fix port only regex

The output is expected to be a list [ hostname, port, optional ipv6 scope ], but the
current regex only outputs [ port ], when only a port is given as address.
This commit is contained in:
Leona Maroni 2024-01-03 21:16:09 +01:00
parent f3c54970ec
commit 9abc79018c
No known key found for this signature in database
GPG Key ID: D5B08ADFC75E3605

View File

@ -11,7 +11,7 @@ let
mkListen = kind: addr: let
al_v4 = builtins.match "([0-9.]+):([0-9]+)($)" addr;
al_v6 = builtins.match "\\[(.+)]:([0-9]+)(%.*|$)" addr;
al_portOnly = builtins.match "([0-9]+)" addr;
al_portOnly = builtins.match "(^)([0-9]+)" addr;
al = findFirst (a: a != null)
(throw "services.kresd.*: incorrect address specification '${addr}'")
[ al_v4 al_v6 al_portOnly ];