nixos/tailscale: run tailscale up when in Stopped status, run tailscaled-set after tailscaled-autoconnect (#409924)

This commit is contained in:
Sandro
2025-11-13 18:04:13 +00:00
committed by GitHub

View File

@@ -213,7 +213,7 @@ in
if [[ "$state" != "$lastState" ]]; then if [[ "$state" != "$lastState" ]]; then
# https://github.com/tailscale/tailscale/blob/v1.72.1/ipn/backend.go#L24-L32 # https://github.com/tailscale/tailscale/blob/v1.72.1/ipn/backend.go#L24-L32
case "$state" in case "$state" in
NeedsLogin) NeedsLogin|NeedsMachineAuth|Stopped)
echo "Server needs authentication, sending auth key" echo "Server needs authentication, sending auth key"
tailscale up --auth-key "$(cat ${cfg.authKeyFile})${params}" ${escapeShellArgs cfg.extraUpFlags} tailscale up --auth-key "$(cat ${cfg.authKeyFile})${params}" ${escapeShellArgs cfg.extraUpFlags}
;; ;;
@@ -235,7 +235,10 @@ in
}; };
systemd.services.tailscaled-set = mkIf (cfg.extraSetFlags != [ ]) { systemd.services.tailscaled-set = mkIf (cfg.extraSetFlags != [ ]) {
after = [ "tailscaled.service" ]; after = [
"tailscaled.service"
"tailscaled-autoconnect.service"
];
wants = [ "tailscaled.service" ]; wants = [ "tailscaled.service" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig = { serviceConfig = {