nixfleet/modules/wireguard-server/default.nix
Andrea Ciceri a394b9cefd
All checks were successful
/ test (push) Successful in 32s
Reformat everything
2024-09-20 11:37:17 +02:00

21 lines
507 B
Nix

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