summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2021-12-16 10:19:50 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2021-12-16 10:19:50 +0100
commit011d2ff791326df1d8383f6895ccc8d65b1ec318 (patch)
treec67defa8d79201e9f1de11aa00c4934653e09d41
parenta9aeb6a12f47d4121a5bf6e672efb8a9893c13a3 (diff)
downloadnixos-011d2ff791326df1d8383f6895ccc8d65b1ec318.tar
nixos-011d2ff791326df1d8383f6895ccc8d65b1ec318.tar.gz
nixos-011d2ff791326df1d8383f6895ccc8d65b1ec318.tar.bz2
nixos-011d2ff791326df1d8383f6895ccc8d65b1ec318.tar.xz
nixos-011d2ff791326df1d8383f6895ccc8d65b1ec318.zip
yggdrasil-wg: ...
-rw-r--r--modules/yggdrasil-wg/default.nix10
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)));