generify the vpn setup

This commit is contained in:
Lillian Violet 2024-12-23 19:22:28 +01:00
parent 8c454565d8
commit c72c30a4be
8 changed files with 68 additions and 79 deletions

View file

@ -10,6 +10,7 @@
./locale
./packages
inputs.home-manager.nixosModules.home-manager
#../hosts/${config.networking.hostName}/hardware-configuration.nix
];
sops = {
age.keyFile = ../../../../../../var/secrets/keys.txt;
@ -134,6 +135,28 @@
pkgs.nerd-fonts.fira-mono
];
networking = {
wireguard.enable = true;
wg-quick.interfaces = {
wg0 = {
autostart = true;
address = ["10.0.0.${config.services.vpn-ip.ip}/24" "fdc9:281f:04d7:9ee9::${config.services.vpn-ip.ip}/64"];
dns = ["10.0.0.1" "fdc9:281f:04d7:9ee9::1"];
listenPort = 51821;
privateKeyFile = config.sops.secrets."wg-private-key".path;
peers = [
{
publicKey = "A02sO7uLdgflhPIRd0cbJONIaPP4z8HTxDkmX4NegFg=";
endpoint = "84.87.146.85:51821";
allowedIPs = ["0.0.0.0/0" "::/0"];
persistentKeepalive = 25;
}
];
};
};
};
# Enable completion of system packages by zsh
environment.pathsToLink = ["/share/zsh"];