feat(t3code): add NixOS module bound to the NetBird interface

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
m3ta-chironandClaude Opus 5.5 committed 2026-11-02 08:00:24 +01:00
1 parent 3d4a39dc74
commit f683e8bf43
4 files changed
+226 -2

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
# Start T3 Code on the interface's current IPv4 address. The address changes
# with the NetBird profile, so it cannot be a Nix value.
# Usage: t3code-serve.sh <interface> <t3 binary>
interface="$1"
t3="$2"
timeout="${T3CODE_ADDR_TIMEOUT:-60}"
address=""
for ((waited = 0; waited < timeout; waited++)); do
line="$(ip -4 -o addr show dev "$interface" 2>/dev/null || true)"
if [[ "$line" =~ inet[[:space:]]+([0-9.]+)/ ]]; then
address="${BASH_REMATCH[1]}"
break
fi
sleep 1
done
if [[ -z "$address" ]]; then
echo "no IPv4 address on $interface after ${timeout}s" >&2
exit 1
fi
exec "$t3" serve --host "$address"