nixfleet/modules/wireguard-server/default.nix
Andrea Ciceri a32c23d474
Some checks failed
/ test (push) Failing after 37m55s
Useless comment and args
2025-04-24 11:55:01 +02:00

21 lines
469 B
Nix

{
config,
lib,
vpn,
...
}:
{
imports = [ ../wireguard-common ];
networking.nat.enable = true;
networking.firewall.allowedUDPPorts = [ config.networking.wireguard.interfaces.wg0.listenPort ];
networking.wireguard.interfaces.wg0 = {
ips = [ "${vpn.${config.networking.hostName}.ip}/24" ];
peers = lib.mapAttrsToList (_hostname: vpnConfig: {
publicKey = vpnConfig.publicKey;
allowedIPs = [ "${vpnConfig.ip}/32" ];
}) vpn;
};
}