From 6208ef964114e11ee4a56cc6277f5d7c5c74f44b Mon Sep 17 00:00:00 2001 From: Christian Date: Thu, 11 Jun 2026 18:26:01 -0500 Subject: Add WireGuard VPN config and xmobar indicator on laptop --- hosts/laptop/configuration.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'hosts/laptop/configuration.nix') diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index 1bfa033..0c87cfe 100644 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -37,11 +37,15 @@ programs.bash.shellAliases = { battery = "echo $(($(cat /sys/class/power_supply/BAT0/charge_now)*100/$(cat /sys/class/power_supply/BAT0/charge_full)))%"; hibernate = "systemctl hibernate"; + vpn-up = "sudo systemctl start wg-quick-wg0"; + vpn-down = "sudo systemctl stop wg-quick-wg0"; }; programs.fish.shellAliases = { battery = "echo (math (cat /sys/class/power_supply/BAT0/charge_now) * 100 / (cat /sys/class/power_supply/BAT0/charge_full))%"; hibernate = "systemctl hibernate"; + vpn-up = "sudo systemctl start wg-quick-wg0"; + vpn-down = "sudo systemctl stop wg-quick-wg0"; }; services.logind = { @@ -58,6 +62,23 @@ }; home-manager.users.christian.custom.xmobarBattery = true; + home-manager.users.christian.custom.xmobarVpn = true; + + # WireGuard — not started on boot, use `wg-quick up wg0` / `wg-quick down wg0` + # Private key must be placed at /etc/wireguard/wg0.key (mode 600, owned by root) + networking.wg-quick.interfaces.wg0 = { + autostart = false; + address = [ "10.67.40.2/32" ]; + privateKeyFile = "/etc/wireguard/wg0.key"; + peers = [ + { + publicKey = "wg37lctIxY4qbcyjVDrEI4mahH2Bhgv+73djEjJSyww="; + endpoint = "vpn.soltermann.xyz:51820"; + allowedIPs = [ "10.67.40.0/24" ]; + persistentKeepalive = 25; + } + ]; + }; swapDevices = [ { -- cgit v1.2.3