diff --git a/modules/wireguard-common/default.nix b/modules/wireguard-common/default.nix index eb6eec9..9ebfc78 100644 --- a/modules/wireguard-common/default.nix +++ b/modules/wireguard-common/default.nix @@ -1,4 +1,9 @@ -{config, ...}: { +{ + lib, + config, + vpn, + ... +}: { networking.firewall.interfaces.wg0 = { allowedUDPPortRanges = [ { @@ -18,4 +23,12 @@ privateKeyFile = config.age.secrets."${config.networking.hostName}-wireguard-private-key".path; listenPort = 51820; }; + + networking.hosts = + lib.mapAttrs' + (hostname: vpnConfig: { + name = vpnConfig.ip; + value = ["${hostname}.fleet"]; + }) + vpn; }