summaryrefslogtreecommitdiff
path: root/modules/wireguard.nix
diff options
context:
space:
mode:
authorChristian <[email protected]>2026-06-11 21:28:59 -0500
committerChristian <[email protected]>2026-06-11 21:28:59 -0500
commit48c36cad2e823d426fddbce5223cd6f9bbef7df8 (patch)
treebdad6f84ee10d7c7a688941d19d9186273af006b /modules/wireguard.nix
parent6208ef964114e11ee4a56cc6277f5d7c5c74f44b (diff)
Extract WireGuard config into shared module, enable on desktop
Diffstat (limited to 'modules/wireguard.nix')
-rw-r--r--modules/wireguard.nix36
1 files changed, 36 insertions, 0 deletions
diff --git a/modules/wireguard.nix b/modules/wireguard.nix
new file mode 100644
index 0000000..8df146d
--- /dev/null
+++ b/modules/wireguard.nix
@@ -0,0 +1,36 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+
+{
+ # 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;
+ }
+ ];
+ };
+
+ programs.bash.shellAliases = {
+ vpn-up = "sudo systemctl start wg-quick-wg0";
+ vpn-down = "sudo systemctl stop wg-quick-wg0";
+ };
+
+ programs.fish.shellAliases = {
+ vpn-up = "sudo systemctl start wg-quick-wg0";
+ vpn-down = "sudo systemctl stop wg-quick-wg0";
+ };
+
+ home-manager.users.christian.custom.xmobarVpn = true;
+}