From ee25c3faf10a4a73aef70fe0b1b93a90f0dc5740 Mon Sep 17 00:00:00 2001 From: Sean Kovacs Date: Thu, 26 Mar 2026 13:40:26 -0400 Subject: [PATCH] shorten system/tailscale --- system/tailscale/default.nix | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) 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 = {