feat: add reusable wireguard-client NixOS module
- modules/nixos/services/wireguard-client.nix — optional module under
gortium.wireguard-client namespace with enable, vpnIp, privateKeyFile,
and presharedKeyFile options
- Added to lazyworkhorse, cyt-pi, and uconsoleBaseModules (covers both
uconsole-cm5 toplevel and SD image)
- Migrated lazyworkhorse from inline networking.wireguard to module
- Split-tunnel: allowedIPs = [ "10.8.0.0/24" ]
Usage in a host config:
gortium.wireguard-client = {
enable = true;
vpnIp = "10.8.0.X/24";
privateKeyFile = config.age.secrets.wireguard_private_key.path;
presharedKeyFile = config.age.secrets.wireguard_preshared_key.path;
};
This commit is contained in:
@@ -49,24 +49,12 @@
|
||||
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
||||
networking.hostId = "deadbeef";
|
||||
|
||||
# WireGuard VPN client -- always up, connects to wg-easy server
|
||||
# Create age-encrypted secrets before deploying (run on the host):
|
||||
# echo -n "<private_key>" | agenix -e secrets/wireguard_private_key.age
|
||||
# echo -n "<preshared_key>" | agenix -e secrets/wireguard_preshared_key.age
|
||||
networking.wireguard.interfaces = {
|
||||
wg0 = {
|
||||
ips = [ "10.8.0.3/24" ];
|
||||
privateKeyFile = config.age.secrets.wireguard_private_key.path;
|
||||
peers = [
|
||||
{
|
||||
publicKey = "rY9zII3AOm8rog2rv02PyA3Bq7zdvTOGkZapfCV1DkE=";
|
||||
presharedKeyFile = config.age.secrets.wireguard_preshared_key.path;
|
||||
allowedIPs = [ "10.8.0.0/24" ];
|
||||
endpoint = "vpn.lazyworkhorse.net:51820";
|
||||
persistentKeepalive = 25;
|
||||
}
|
||||
];
|
||||
};
|
||||
# WireGuard VPN client -- module, always up, connects to wg-easy server
|
||||
gortium.wireguard-client = {
|
||||
enable = true;
|
||||
vpnIp = "10.8.0.3/24";
|
||||
privateKeyFile = config.age.secrets.wireguard_private_key.path;
|
||||
presharedKeyFile = config.age.secrets.wireguard_preshared_key.path;
|
||||
};
|
||||
|
||||
# Set your time zone.
|
||||
|
||||
Reference in New Issue
Block a user