From d0bccd67bdeb333b61c2c3e1aed4bf2229ae1272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Schr=C3=B6ter?= Date: Sun, 21 Jan 2024 21:40:27 +0100 Subject: [PATCH] fix(vpn): fix autoconnect issues --- system/vpn.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/system/vpn.nix b/system/vpn.nix index b75d997..854e06b 100644 --- a/system/vpn.nix +++ b/system/vpn.nix @@ -3,6 +3,8 @@ let cfg = config.services.tailscale; tailscaleInterface = cfg.interfaceName; + inherit (config.networking) hostName; + tailnetHost = "${hostName}.tail05275.ts.net"; in { networking.wireguard.enable = true; networking.firewall.trustedInterfaces = [ tailscaleInterface ]; @@ -27,7 +29,10 @@ in { systemd.services.tailscaled-autoconnect.script = '' status=$(${config.systemd.package}/bin/systemctl show -P StatusText tailscaled.service) if [[ $status != Connected* ]]; then - ${cfg.package}/bin/tailscale up ${lib.escapeShellArgs cfg.extraUpFlags} + ${cfg.package}/bin/tailscale up fi + + # some options cannot be set immediately + ${cfg.package}/bin/tailscale up ${lib.escapeShellArgs cfg.extraUpFlags} ''; }