From 5ba3015b48f6b02a71e1c27d44749af9522de57d Mon Sep 17 00:00:00 2001 From: Mike O'Driscoll Date: Fri, 3 Apr 2026 19:57:26 -0400 Subject: [PATCH] flake.nix: add patch for debug/mod.go (#19238) --- flake.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index abcd8f2f9..cf2f53178 100644 --- a/flake.nix +++ b/flake.nix @@ -55,7 +55,7 @@ system = system; overlays = [ (final: prev: { - go_1_26 = prev.go_1_26.overrideAttrs { + go_1_26 = prev.go_1_26.overrideAttrs (old: { version = goVersion; src = prev.fetchFromGitHub { owner = "tailscale"; @@ -63,7 +63,19 @@ rev = toolChainRev; sha256 = gitHash; }; - }; + # The Tailscale Go fork carries a placeholder in + # src/runtime/debug/mod.go that must be replaced with + # the actual toolchain git rev at build time. Without + # this, binaries report an empty tailscale.toolchain.rev + # and the runtime assertion in + # assert_ts_toolchain_match.go panics. + postPatch = + (old.postPatch or "") + + '' + substituteInPlace src/runtime/debug/mod.go \ + --replace-fail "TAILSCALE_GIT_REV_TO_BE_REPLACED_AT_BUILD_TIME" "${toolChainRev}" + ''; + }); }) ]; }));