diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/yggdrasil-wg/default.nix | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/yggdrasil-wg/default.nix b/modules/yggdrasil-wg/default.nix index 67d73b70..1ffb8af6 100644 --- a/modules/yggdrasil-wg/default.nix +++ b/modules/yggdrasil-wg/default.nix | |||
@@ -203,7 +203,8 @@ in { | |||
203 | Destination = "${batSubnet}::/${toString batSubnetLength}"; | 203 | Destination = "${batSubnet}::/${toString batSubnetLength}"; |
204 | }; | 204 | }; |
205 | } | 205 | } |
206 | ] ++ (concatMap (router: map (rAddr: { routeConfig = { Destination = "::/0"; Metric = 2048; Gateway = stripSubnet rAddr; }; }) batHostIPs.${router}) routers); | 206 | ] ++ (concatMap (router: map (rAddr: { routeConfig = { Destination = "::/0"; Gateway = stripSubnet rAddr; Table = "yggdrasil"; }; }) batHostIPs.${router}) routers); |
207 | routingPolicyRules = map (addr: { routingPolicyRuleConfig = { Table = "yggdrasil"; From = stripSubnet addr; Priority = 1; }; }) batHostIPs.${hostName}; | ||
207 | linkConfig = { | 208 | linkConfig = { |
208 | MACAddress = "${batHostMACs.${hostName}}"; | 209 | MACAddress = "${batHostMACs.${hostName}}"; |
209 | RequiredForOnline = false; | 210 | RequiredForOnline = false; |
@@ -212,6 +213,13 @@ in { | |||
212 | } // listToAttrs (map familyToYggdrasilNetwork hostFamilies) // listToAttrs (concatMap (family: imap0 (linkToGreNetwork family) hostLinks.${family}) hostFamilies); | 213 | } // listToAttrs (map familyToYggdrasilNetwork hostFamilies) // listToAttrs (concatMap (family: imap0 (linkToGreNetwork family) hostLinks.${family}) hostFamilies); |
213 | }; | 214 | }; |
214 | 215 | ||
216 | environment.etc."systemd/networkd.conf" = mkIf inNetwork { | ||
217 | text = '' | ||
218 | [Network] | ||
219 | RouteTable=yggdrasil:200 | ||
220 | ''; | ||
221 | }; | ||
222 | |||
215 | sops.secrets = listToAttrs (map familyToSopsSecret hostFamilies); | 223 | sops.secrets = listToAttrs (map familyToSopsSecret hostFamilies); |
216 | 224 | ||
217 | networking.hosts = mkIf inNetwork (listToAttrs (concatMap ({name, value}: map (ip: nameValuePair (stripSubnet ip) ["${name}.yggdrasil"]) value) (mapAttrsToList nameValuePair batHostIPs))); | 225 | networking.hosts = mkIf inNetwork (listToAttrs (concatMap ({name, value}: map (ip: nameValuePair (stripSubnet ip) ["${name}.yggdrasil"]) value) (mapAttrsToList nameValuePair batHostIPs))); |