diff --git a/system/tailscale/default.nix b/system/tailscale/default.nix index 90e21a8..2a7d652 100644 --- a/system/tailscale/default.nix +++ b/system/tailscale/default.nix @@ -7,26 +7,21 @@ lib, ... }: -let - tailscaleWaitScript = pkgs.writeShellScript "tailscale-wait-for-ip" '' - echo "Waiting for tailscale0 to get an IP address..." - for i in {1..15}; do - if ${lib.getExe' pkgs.iproute2 "ip"} addr show dev tailscale0 2>/dev/null | ${lib.getExe' pkgs.gnugrep "grep"} -q 'inet '; then - echo "tailscale0 has IP address" - exit 0 - fi - echo "Attempt $i" - sleep 1 - done - echo "Warning: tailscale0 did not get IP address within 15 seconds" - exit 0 - ''; -in { systemd.services.tailscaled = { - serviceConfig = { - ExecStartPost = tailscaleWaitScript; - }; + serviceConfig.ExecStartPost = pkgs.writeShellScript "tailscale-wait-for-ip" '' + echo "Waiting for tailscale0 to get an IP address..." + for i in {1..15}; do + if ${lib.getExe' pkgs.iproute2 "ip"} addr show dev tailscale0 2>/dev/null | ${lib.getExe' pkgs.gnugrep "grep"} -q 'inet '; then + echo "tailscale0 has IP address" + exit 0 + fi + echo "Attempt $i" + sleep 1 + done + echo "Warning: tailscale0 did not get IP address within 15 seconds" + exit 0 + ''; }; services.tailscale = {