hackens-org-configurations/machines/hackens-org/wireguard.nix

68 lines
1.5 KiB
Nix
Raw Normal View History

2024-01-12 18:07:38 +01:00
{
config,
lib,
pkgs,
...
}: {
systemd.network = {
enable = true;
networks = {
"50-wg0" = {
name = "wg0";
address = [
"10.10.10.1/24"
];
routes = [{
routeConfig = {
Destination = "10.10.10.0/24";
Scope = "link";
};
}];
2024-03-03 12:16:09 +01:00
networkConfig = {
IPForward = true;
};
2024-01-12 18:07:38 +01:00
};
};
netdevs = {
"50-wg0" = {
netdevConfig = {
Name = "wg0";
Kind = "wireguard";
};
wireguardConfig = {
ListenPort = 1194;
PrivateKeyFile = config.age.secrets."wg-key".path;
};
wireguardPeers = [
2024-03-03 12:16:09 +01:00
{ #bakham (AGB)
wireguardPeerConfig = {
AllowedIPs = [
"10.10.10.5/32"
];
PublicKey = "JpUHFiavhlQfiHfOdUffQP3HLLeStttheACCaqlXAF8=";
};
}
{ #soyouzpanda
wireguardPeerConfig = {
AllowedIPs = [
"10.10.10.11/32"
];
PublicKey = "/xjWqkiyHY93wqo/Apj5SHP8UaXF4mKQRVwylKC2wy8=";
};
}
{ #sinavir
wireguardPeerConfig = {
AllowedIPs = [
"10.10.10.12/32"
];
PublicKey = "kmc3PexCMKm1Tg8WUDbHaOkcWLl8KUh52CtrDOODf0M=";
};
}
2024-01-12 18:07:38 +01:00
];
};
};
};
networking.firewall.allowedUDPPorts = [ 1194 ];
}