2024-09-06 01:18:21 -04:00
|
|
|
{outputs, ...}: let
|
|
|
|
ips = import ../modules/ips.nix;
|
|
|
|
in {
|
|
|
|
# enable NAT
|
2024-09-07 00:38:19 -04:00
|
|
|
networking = {
|
|
|
|
nat = {
|
|
|
|
enable = true;
|
|
|
|
externalInterface = "${ips.netInt}";
|
|
|
|
internalInterfaces = [ "wg0" ];
|
|
|
|
};
|
|
|
|
firewall.allowedUDPPorts = [ 51820 ];
|
|
|
|
};
|
2024-09-06 01:18:21 -04:00
|
|
|
|
|
|
|
networking.wireguard = {
|
|
|
|
enable = true;
|
|
|
|
interfaces = {
|
|
|
|
# Wireguard interface name can be arbitrary
|
|
|
|
wg0 = {
|
|
|
|
# Determines the IP address and subnet of the server's end of the tunnel interface.
|
|
|
|
ips = [ "10.100.0.1/24" ];
|
|
|
|
listenPort = 51820;
|
|
|
|
privateKey = outputs.secrets.wireguardPriv;
|
|
|
|
peers = [
|
2024-09-08 10:30:01 -04:00
|
|
|
{ # Jimbo Pixel 9
|
|
|
|
publicKey = outputs.secrets.wirePixel9Pub;
|
2024-09-06 01:18:21 -04:00
|
|
|
allowedIPs = [ "10.100.0.2/32" ];
|
|
|
|
}
|
2024-09-08 10:30:01 -04:00
|
|
|
{ # Jimbo Pixel 4
|
|
|
|
publicKey = outputs.secrets.wirePixel4Pub;
|
|
|
|
allowedIPs = [ "10.100.0.3/32" ];
|
|
|
|
}
|
2024-09-06 01:18:21 -04:00
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|