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
commit35be9c66bfa6dd03437f919ec610aed0e9b20b58 (patch)
tree8f86aee06b0c6ac43d2e7e158f5497fa0e4b89a0 /lib
parent474e3e2e4513a5d2df89789885725b176e7ec532 (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 64b2d48ab..347830e8c 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