configuration.nix/hosts/skipper/wireguard.nix

31 lines
609 B
Nix
Raw Normal View History

2024-03-31 22:28:56 +05:30
{ secrets, ... }:
let
2024-05-12 15:11:00 +05:30
wireguard_server = secrets.wireguard_server // {
2024-03-31 22:28:56 +05:30
persistentKeepalive = 20;
allowedIPs = [
"10.10.10.0/24"
"fd7c:585c:c4ae::0/64"
];
2024-05-12 15:11:00 +05:30
};
2024-03-31 22:28:56 +05:30
in
{
networking.firewall.trustedInterfaces = [ "wg0" ];
networking.wireguard = {
enable = true;
interfaces = {
wg0 = {
ips = [
"10.10.10.2/24"
"fd7c:585c:c4ae::2/64"
];
listenPort = 51822;
privateKeyFile = "/etc/wireguard/private.key";
generatePrivateKeyFile = true;
peers = [
wireguard_server
];
};
};
};
}