shorten system/tailscale
This commit is contained in:
parent
d5bd220838
commit
ee25c3faf1
1 changed files with 13 additions and 18 deletions
|
|
@ -7,8 +7,9 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
{
|
||||||
tailscaleWaitScript = pkgs.writeShellScript "tailscale-wait-for-ip" ''
|
systemd.services.tailscaled = {
|
||||||
|
serviceConfig.ExecStartPost = pkgs.writeShellScript "tailscale-wait-for-ip" ''
|
||||||
echo "Waiting for tailscale0 to get an IP address..."
|
echo "Waiting for tailscale0 to get an IP address..."
|
||||||
for i in {1..15}; do
|
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
|
if ${lib.getExe' pkgs.iproute2 "ip"} addr show dev tailscale0 2>/dev/null | ${lib.getExe' pkgs.gnugrep "grep"} -q 'inet '; then
|
||||||
|
|
@ -21,12 +22,6 @@ let
|
||||||
echo "Warning: tailscale0 did not get IP address within 15 seconds"
|
echo "Warning: tailscale0 did not get IP address within 15 seconds"
|
||||||
exit 0
|
exit 0
|
||||||
'';
|
'';
|
||||||
in
|
|
||||||
{
|
|
||||||
systemd.services.tailscaled = {
|
|
||||||
serviceConfig = {
|
|
||||||
ExecStartPost = tailscaleWaitScript;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
services.tailscale = {
|
services.tailscale = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue