From 0f06a86b1eaa99ff21cdce8c5f1c54b688cbbcf6 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 1 Aug 2024 10:48:06 +0200 Subject: ... --- modules/yggdrasil-wg/default.nix | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'modules/yggdrasil-wg') diff --git a/modules/yggdrasil-wg/default.nix b/modules/yggdrasil-wg/default.nix index 8525cea0..8b190651 100644 --- a/modules/yggdrasil-wg/default.nix +++ b/modules/yggdrasil-wg/default.nix @@ -135,7 +135,7 @@ let PrivateKeyFile = "/run/credentials/systemd-networkd.service/yggdrasil-wg-${family}.priv"; ListenPort = listenPort.${family}; }; - wireguardPeers = map (opts@{to, from, ...}: { wireguardPeerConfig = linkToPeer family opts; }) hostLinks.${family}; + wireguardPeers = map (opts@{to, from, ...}: linkToPeer family opts) hostLinks.${family}; }; familyToLoadCred = family: "yggdrasil-wg-${family}.priv:${config.sops.secrets."yggdrasil-wg-${family}.priv".path}"; familyToYggdrasilNetwork = family: nameValuePair "yggdrasil-wg-${family}" { @@ -145,9 +145,7 @@ let }; address = [wgHostIPs.${family}.${hostName}]; routes = [ - { routeConfig = { - Destination = "${wgSubnet.${family}}::/${toString wgSubnetLength}"; - }; + { Destination = "${wgSubnet.${family}}::/${toString wgSubnetLength}"; } ]; linkConfig = { @@ -203,25 +201,19 @@ in { dns = ["2a03:4000:52:ada:1:1::"]; domains = ["yggdrasil"]; routes = [ - { routeConfig = { - Destination = "${batSubnet}::/${toString batSubnetLength}"; - GatewayOnLink = true; - }; + { Destination = "${batSubnet}::/${toString batSubnetLength}"; + GatewayOnLink = true; } - { routeConfig = { - Destination = "${batSubnet}::/${toString batSubnetLength}"; - GatewayOnLink = true; - Table = "yggdrasil"; - }; + { Destination = "${batSubnet}::/${toString batSubnetLength}"; + GatewayOnLink = true; + Table = "yggdrasil"; } - { routeConfig = { - Destination = batHostIPs.${hostName}; - GatewayOnLink = true; - Table = "yggdrasil"; - }; + { Destination = batHostIPs.${hostName}; + GatewayOnLink = true; + Table = "yggdrasil"; } - ] ++ (concatMap (router: map (rAddr: { routeConfig = { Destination = "::/0"; Gateway = stripSubnet rAddr; GatewayOnLink = true; Table = "yggdrasil"; }; }) batHostIPs.${router}) (filter (router: router != hostName) routers)); - routingPolicyRules = map (addr: { routingPolicyRuleConfig = { Table = "yggdrasil"; From = addr; Priority = 1; }; }) batHostIPs.${hostName}; + ] ++ (concatMap (router: map (rAddr: { Destination = "::/0"; Gateway = stripSubnet rAddr; GatewayOnLink = true; Table = "yggdrasil"; }) batHostIPs.${router}) (filter (router: router != hostName) routers)); + routingPolicyRules = map (addr: { Table = "yggdrasil"; From = addr; Priority = 1; }) batHostIPs.${hostName}; linkConfig = { MACAddress = "${batHostMACs.${hostName}}"; RequiredForOnline = false; -- cgit v1.2.3