hackens-org-configurations/machines/hackens-org/wireguard.nix
2024-03-03 12:16:09 +01:00

67 lines
1.5 KiB
Nix

{
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";
};
}];
networkConfig = {
IPForward = true;
};
};
};
netdevs = {
"50-wg0" = {
netdevConfig = {
Name = "wg0";
Kind = "wireguard";
};
wireguardConfig = {
ListenPort = 1194;
PrivateKeyFile = config.age.secrets."wg-key".path;
};
wireguardPeers = [
{ #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=";
};
}
];
};
};
};
networking.firewall.allowedUDPPorts = [ 1194 ];
}