From 5b7be699f309df3478613ac53b13f44ed5315981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Schr=C3=B6ter?= <dev@felschr.com> Date: Fri, 6 Jun 2025 18:02:04 +0200 Subject: [PATCH] chore(home-server): improve IP retrieval for dyn DNS --- hosts/home-server/default.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hosts/home-server/default.nix b/hosts/home-server/default.nix index 931d571..461cd35 100644 --- a/hosts/home-server/default.nix +++ b/hosts/home-server/default.nix @@ -74,14 +74,13 @@ in ''; services.inadyn.ipv4.enable = true; services.inadyn.ipv4.command = "${pkgs.writeScript "get-ipv4" '' - ${pkgs.tailscale}/bin/tailscale status --json \ - | ${pkgs.jq}/bin/jq -r '.Self.Addrs[0]' \ - | cut -f1 -d":" + eth=$(ls /sys/class/net | grep -E '^(enp|eth)' | head -1) + ${pkgs.curl}/bin/curl -4 --interface "$eth" ip.me ''}"; services.inadyn.ipv6.enable = true; services.inadyn.ipv6.command = "${pkgs.writeScript "get-ipv6" '' - ${pkgs.iproute2}/bin/ip -6 addr show scope global \ - | ${pkgs.grepcidr}/bin/grepcidr '2000::/3' \ + eth=$(ls /sys/class/net | grep -E '^(enp|eth)' | head -1) + ${pkgs.iproute2}/bin/ip -6 addr show dev "$eth" scope global to '2000::/3' \ | grep -o '[0-9a-f:]*::102' ''}"; services.inadyn.domains = [