NixOS-Config/modules/system/devices/networking/wireguard/server/default.nix

33 lines
829 B
Nix
Raw Normal View History

{ config, ... }:
2024-10-09 03:36:08 -04:00
{
networking = {
nat = {
enable = true;
externalInterface = "${config.ips.netInt}";
internalInterfaces = [ "${config.ips.wgInt}" ];
};
firewall.allowedUDPPorts = [ 51820 ];
};
2024-09-06 01:18:21 -04:00
networking.wireguard = {
enable = true;
interfaces = {
"${config.ips.wgInt}" = {
ips = [ "${config.ips.wgSpan}.1/24" ];
2024-09-06 01:18:21 -04:00
listenPort = 51820;
privateKey = config.secrets.wgServerPriv;
2024-09-06 01:18:21 -04:00
peers = [
{ # NixOS
publicKey = "OKUH/h6YSURI4vgeTZKQD15QsqaygdbTn1mAWzQp9S0=";
allowedIPs = [ "${config.ips.wgSpan}.16/28" ];
}
{ # Pixel 9
publicKey = "dPCtjm67adMZCnyL1O2L+uUOk0RbjA9T/tht1r+qcE4=";
allowedIPs = [ "${config.ips.wgSpan}.2/32" ];
}
2024-09-06 01:18:21 -04:00
];
};
};
};
}