summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2018-12-12 00:34:32 +0100
committertv <tv@krebsco.de>2018-12-12 00:34:32 +0100
commitca73242cda966672b314a7378652bf8294a512e5 (patch)
tree68e2958a2fb6fd9bff1c6250a0a5dcdf7bd0c7d2 /lib
parent8fb373ff9ca49299b6a8600fb9b181fb21989d1b (diff)
lib.normalize-ip6-addr: no :: for single section
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 64b2d48..347830e 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -93,7 +93,13 @@ let
in
if max.pos == 0
then a
- else "${concatStringsSep ":" lhs}::${concatStringsSep ":" rhs}";
+ else let
+ sep =
+ if 8 - (length lhs + length rhs) == 1
+ then ":0:"
+ else "::";
+ in
+ "${concatStringsSep ":" lhs}${sep}${concatStringsSep ":" rhs}";
drop-leading-zeros =
let