Server/tailscale: wait to get ip address
This commit is contained in:
parent
16fa01ad7d
commit
2c45da4844
1 changed files with 16 additions and 1 deletions
|
|
@ -1,6 +1,21 @@
|
|||
{...}: {
|
||||
{pkgs, ...}: let
|
||||
script = pkgs.writeShellApplication {
|
||||
name = "tailscale-wait-for-ip";
|
||||
runtimeInputs = [pkgs.iproute2];
|
||||
text = ''
|
||||
# Based on https://github.com/tailscale/tailscale/issues/11504#issuecomment-2113331262
|
||||
echo Waiting for tailscale0 to get an IP adress..
|
||||
for i in {1..15}; do
|
||||
if ip addr show dev tailscale0 | grep -q 'inet '; then break; fi
|
||||
echo "$i"
|
||||
sleep 1
|
||||
done
|
||||
'';
|
||||
};
|
||||
in {
|
||||
services.tailscale = {
|
||||
# This is needed for being an exit node
|
||||
useRoutingFeatures = "server";
|
||||
};
|
||||
systemd.services.tailscaled.postStart = "${script}/bin/tailscale-wait-for-ip";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue