wiregrill: handle networkd carrier loss

This commit is contained in:
lassulus 2023-09-03 12:14:41 +02:00
parent d08fc3f507
commit 8b89fed120

View File

@ -29,17 +29,21 @@ in mkIf (hasAttr "wiregrill" config.krebs.build.host.nets) {
(optional (!isNull self.ip4) "${self.ip4.addr}/16") ++ (optional (!isNull self.ip4) "${self.ip4.addr}/16") ++
(optional (!isNull self.ip6) "${self.ip6.addr}/48") (optional (!isNull self.ip6) "${self.ip6.addr}/48")
; ;
networkConfig = {
IgnoreCarrierLoss = "10s";
};
}; };
networking.wireguard.interfaces.wiregrill = { networking.wireguard.interfaces.wiregrill = {
ips = ips =
(optional (!isNull self.ip4) self.ip4.addr) ++ (optional (!isNull self.ip4 && !config.systemd.network.enable) self.ip4.addr) ++
(optional (!isNull self.ip6) self.ip6.addr); (optional (!isNull self.ip6 && !config.systemd.network.enable) self.ip6.addr);
listenPort = 51820; listenPort = 51820;
privateKeyFile = (toString <secrets>) + "/wiregrill.key"; privateKeyFile = (toString <secrets>) + "/wiregrill.key";
allowedIPsAsRoutes = true; allowedIPsAsRoutes = true;
peers = mapAttrsToList peers = mapAttrsToList
(_: host: { (name: host: {
# inherit name;
allowedIPs = if isRouter then allowedIPs = if isRouter then
(optional (!isNull host.nets.wiregrill.ip4) host.nets.wiregrill.ip4.addr) ++ (optional (!isNull host.nets.wiregrill.ip4) host.nets.wiregrill.ip4.addr) ++
(optional (!isNull host.nets.wiregrill.ip6) host.nets.wiregrill.ip6.addr) (optional (!isNull host.nets.wiregrill.ip6) host.nets.wiregrill.ip6.addr)