openvpn: update PR#109643
[sourcephile-nix.git] / hosts / losurdo / networking / wireguard / intranet.nix
index 8c09db11c1f88232e1d276a7ed305f8c17730ba5..f7cccae013d1e1bf27158ac864fc28b7fff132bc 100644 (file)
@@ -5,14 +5,8 @@ let
   inherit (config.boot) initrd;
   iface = "wg-intra";
   wg = config.networking.wireguard.interfaces.${iface};
-  relay =
-    hosts.mermet.extraArgs //
-    hosts.mermet.config.networking.wireguard.interfaces.${iface} //
-    lib.head (lib.filter (peer:
-      peer.endpoint != null &&
-      builtins.match "^\(.*\):[0-9]*$" peer.endpoint ==
-        [hosts.mermet.extraArgs.ipv4])
-      wg.peers);
+  wg-intra-hosts = import ../../../../networking/wireguard/wg-intra/hosts.nix;
+  relay = wg-intra-hosts.mermet;
 in
 {
 imports = [
@@ -89,7 +83,7 @@ boot.initrd.network.postCommands = ''
   wg set ${iface} private-key /root/initrd/${iface}.key \
      listen-port ${toString wg.listenPort}
   ip link set up dev ${iface}
-  wg set ${iface} peer ${relay.publicKey} \
+  wg set ${iface} peer ${relay.peer.publicKey} \
      endpoint ${relay.ipv4}:${toString relay.listenPort} \
      allowed-ips ${relay.ipv4}/32 \
      persistent-keepalive 5