diff options
Diffstat (limited to 'modules/yggdrasil-wg')
-rw-r--r-- | modules/yggdrasil-wg/default.nix | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/yggdrasil-wg/default.nix b/modules/yggdrasil-wg/default.nix index 86e2b98a..6e49214e 100644 --- a/modules/yggdrasil-wg/default.nix +++ b/modules/yggdrasil-wg/default.nix | |||
@@ -80,15 +80,12 @@ let | |||
80 | linkToGreNetwork = ix: opts@{from, to, ...}: | 80 | linkToGreNetwork = ix: opts@{from, to, ...}: |
81 | let | 81 | let |
82 | other = if from == hostName then to else from; | 82 | other = if from == hostName then to else from; |
83 | hexIx = let | ||
84 | hexIx' = toHexString ix; | ||
85 | in if (stringLength hexIx' < 2) then "0${hexIx'}" else hexIx'; | ||
86 | in nameValuePair "yggre-${other}" { | 83 | in nameValuePair "yggre-${other}" { |
87 | matchConfig = { | 84 | matchConfig = { |
88 | Name = "yggre-${other}"; | 85 | Name = "yggre-${other}"; |
89 | }; | 86 | }; |
90 | linkConfig = { | 87 | linkConfig = { |
91 | MACAddress = "${greHostMACPrefixes.${hostName}}:${hexIx}"; | 88 | MACAddress = "${greHostMACPrefixes.${hostName}}:${toHexByte ix}"; |
92 | RequiredForOnline = false; | 89 | RequiredForOnline = false; |
93 | }; | 90 | }; |
94 | networkConfig = { | 91 | networkConfig = { |
@@ -104,6 +101,9 @@ let | |||
104 | withoutOpts = listToAttrs (map (nv: nameValuePair nv.name (removeAttrs nv.value [optName])) (filter (x: !(x.value.${optName} or false)) (imap0 (ix: nameValuePair (toString ix)) xs))); | 101 | withoutOpts = listToAttrs (map (nv: nameValuePair nv.name (removeAttrs nv.value [optName])) (filter (x: !(x.value.${optName} or false)) (imap0 (ix: nameValuePair (toString ix)) xs))); |
105 | in genList (ix: withOpts.${toString ix} or withoutOpts.${toString ix}) (length xs); | 102 | in genList (ix: withOpts.${toString ix} or withoutOpts.${toString ix}) (length xs); |
106 | mkLinks = optIx "udp2raw"; | 103 | mkLinks = optIx "udp2raw"; |
104 | toHexByte = n: let | ||
105 | hex = toHexString n; | ||
106 | in if (stringLength hex < 2) then "0${hex}" else hex; | ||
107 | in { | 107 | in { |
108 | config = { | 108 | config = { |
109 | assertions = [ | 109 | assertions = [ |