fix(vpn): fix autoconnect issues
This commit is contained in:
parent
e514664004
commit
d0bccd67bd
|
@ -3,6 +3,8 @@
|
||||||
let
|
let
|
||||||
cfg = config.services.tailscale;
|
cfg = config.services.tailscale;
|
||||||
tailscaleInterface = cfg.interfaceName;
|
tailscaleInterface = cfg.interfaceName;
|
||||||
|
inherit (config.networking) hostName;
|
||||||
|
tailnetHost = "${hostName}.tail05275.ts.net";
|
||||||
in {
|
in {
|
||||||
networking.wireguard.enable = true;
|
networking.wireguard.enable = true;
|
||||||
networking.firewall.trustedInterfaces = [ tailscaleInterface ];
|
networking.firewall.trustedInterfaces = [ tailscaleInterface ];
|
||||||
|
@ -27,7 +29,10 @@ in {
|
||||||
systemd.services.tailscaled-autoconnect.script = ''
|
systemd.services.tailscaled-autoconnect.script = ''
|
||||||
status=$(${config.systemd.package}/bin/systemctl show -P StatusText tailscaled.service)
|
status=$(${config.systemd.package}/bin/systemctl show -P StatusText tailscaled.service)
|
||||||
if [[ $status != Connected* ]]; then
|
if [[ $status != Connected* ]]; then
|
||||||
${cfg.package}/bin/tailscale up ${lib.escapeShellArgs cfg.extraUpFlags}
|
${cfg.package}/bin/tailscale up
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# some options cannot be set immediately
|
||||||
|
${cfg.package}/bin/tailscale up ${lib.escapeShellArgs cfg.extraUpFlags}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue