From a636d39b9f10d51c6ce23dadbc099252bc9dda37 Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Mon, 23 Nov 2026 11:49:47 -0600 Subject: [PATCH] fix(nix): pin Bun to the pristine official 1.4.5 build in the dev shells (#13337) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fleet-build runner crashes vitest workers at startup on pkgs/id/web (pre-existing on main). Diagnosis, with the full evidence table recorded on #13337: the deciding variable is the nixpkgs patchelf repack, not the Bun version and not the build flavor. The repacked binary crashes the worker on the fleet runner hosts — SIGSEGV with the baseline x86_64 flavor, SIGABRT with the regular flavor, at both 1.4.2 (pkgs/id's pin) and 1.4.5 — while the pristine official 1.4.5 binary passes the same suite in the same runner (fleet run 45235514872: 2 files, 7 tests), and the same repacked binaries pass on other hosts. So the dev shells now carry the pristine upstream binary, installed untouched (fetchzip of the official release zip, no patchelf, no strip), at the shell sites that consumed the unpinned nixpkgs bun: - pkgs/id/nix-common.nix: the id dev shell inputs — the bun the reproduced `nix develop` vitest command actually runs. - lib/default.nix devShells: the mcpx shell and the fleet shell (the shell the fleet-build image warms for this repo). The pristine binary needs the system loader at runtime (/lib64/ld-linux or nix-ld; both present on the fleet's machines and in the fleet-build container), so this stays a shells-only change: the web package builds keep their own pkgs.bun (see pkgs/id/flake.nix), and the mcpx-e2e-test image — whose rootfs has no /lib64 loader and which executes bun as a test runtime — keeps the nixpkgs package as well. 1.4.5 is also the version the fleet-build Containerfile pins. Verified: the pristine derivation builds and runs (1.4.5) on the laptop via nix-ld; eval checks show 1.4.5 in the id, fleet and mcpx shells; the runner-side green run of the issue's exact reproduced command against this branch is recorded on #13337. --- lib/default.nix | 55 ++++++++++++++++++++++++++++++++++++++++-- pkgs/id/nix-common.nix | 55 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 107 insertions(+), 3 deletions(-) diff --git a/lib/default.nix b/lib/default.nix index 3b291df051..800879e72d 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -545,6 +545,57 @@ let }; # Import shared configuration (same as shell.nix) nixCommon = import ../nix-common.nix { inherit pkgs; }; + + # Bun pinned to the pristine official 1.4.5 build + # (#13337) — the upstream release binary, installed + # untouched. The nixpkgs package is a patchelf repack, + # and the repacked binary crashes vitest workers at + # startup on the fleet runner hosts (both x86_64 flavors, + # at 1.4.2 and 1.4.5), while the pristine 1.4.5 binary + # passes the same suite in the same runner; the evidence + # table is recorded on #13337. 1.4.5 is also the + # fleet-build Containerfile's pin. The pristine binary + # needs the system loader at runtime (/lib64/ld-linux or + # nix-ld, both present on the fleet's machines and in the + # fleet-build container); shells only. Bump version + + # hashes together, deliberately. + bunPinned = + let + zips = { + "x86_64-linux" = { + file = "bun-linux-x64.zip"; + hash = "sha256-WCYOHQDhVan4VY5fXl1miwZQ3hNxCUnMeutJdXx0kFY="; + }; + "aarch64-linux" = { + file = "bun-linux-aarch64.zip"; + hash = "sha256-EkeG+qsv7hosvxqyHtkjizI8eDF5TW5hFYvHbw4SFpQ="; + }; + "aarch64-darwin" = { + file = "bun-darwin-aarch64.zip"; + hash = "sha256-mNY87B6ZYhDS4b8MDp+pR/7fnXvLes4A0kUdokvavwk="; + }; + }; + zip = zips.${pkgs.stdenv.hostPlatform.system}; + in + pkgs.stdenvNoCC.mkDerivation { + pname = "bun"; + version = "1.4.5"; + src = pkgs.fetchzip { + url = "https://github.com/oven-sh/bun/releases/download/bun-v1.4.5/${zip.file}"; + hash = zip.hash; + }; + installPhase = '' + runHook preInstall + install -Dm 755 bun $out/bin/bun + ln -s bun $out/bin/bunx + runHook postInstall + ''; + meta = { + description = "Incredibly fast JavaScript runtime, bundler, test runner, and package manager (pristine upstream binary)"; + homepage = "https://bun.sh"; + license = pkgs.lib.licenses.mit; + }; + }; in { default = pkgs.mkShell { @@ -607,7 +658,7 @@ let go_1_27 gopls deno - bun + bunPinned nodejs git python3 @@ -635,7 +686,7 @@ let jq ripgrep go_1_27 - bun + bunPinned nodejs zig ]); diff --git a/pkgs/id/nix-common.nix b/pkgs/id/nix-common.nix index 828ce1a8b8..7e118d8d0d 100644 --- a/pkgs/id/nix-common.nix +++ b/pkgs/id/nix-common.nix @@ -24,6 +24,59 @@ let rocCompiler = pkgs.callPackage ./nix/roc.nix { }; zig = pkgs.zig_0_16; + # Bun pinned to the pristine official 1.4.5 build (#13337) — the + # upstream release binary, installed untouched. The nixpkgs package + # is a patchelf repack, and the repacked binary crashes vitest + # workers at startup on the fleet runner hosts (SIGSEGV with the + # baseline x86_64 flavor, SIGABRT with the regular flavor, at both + # 1.4.2 and 1.4.5), while the pristine 1.4.5 binary passes the same + # suite in the same runner and the repack passes on other hosts — + # the full evidence table is recorded on #13337. 1.4.5 is also the + # version the fleet-build Containerfile pins. Because the binary is + # pristine, it needs the system loader at runtime (/lib64/ld-linux + # or nix-ld, both present on the fleet's machines and in the + # fleet-build container); it is used in shells only — the web + # package builds keep their own pkgs.bun (see pkgs/id/flake.nix). + # Bump version + hashes together, deliberately, never by a lock + # update alone. + bunPinned = + let + zips = { + "x86_64-linux" = { + file = "bun-linux-x64.zip"; + hash = "sha256-WCYOHQDhVan4VY5fXl1miwZQ3hNxCUnMeutJdXx0kFY="; + }; + "aarch64-linux" = { + file = "bun-linux-aarch64.zip"; + hash = "sha256-EkeG+qsv7hosvxqyHtkjizI8eDF5TW5hFYvHbw4SFpQ="; + }; + "aarch64-darwin" = { + file = "bun-darwin-aarch64.zip"; + hash = "sha256-mNY87B6ZYhDS4b8MDp+pR/7fnXvLes4A0kUdokvavwk="; + }; + }; + zip = zips.${pkgs.stdenv.hostPlatform.system}; + in + pkgs.stdenvNoCC.mkDerivation { + pname = "bun"; + version = "1.4.5"; + src = pkgs.fetchzip { + url = "https://github.com/oven-sh/bun/releases/download/bun-v1.4.5/${zip.file}"; + hash = zip.hash; + }; + installPhase = '' + runHook preInstall + install -Dm 755 bun $out/bin/bun + ln -s bun $out/bin/bunx + runHook postInstall + ''; + meta = { + description = "Incredibly fast JavaScript runtime, bundler, test runner, and package manager (pristine upstream binary)"; + homepage = "https://bun.sh"; + license = pkgs.lib.licenses.mit; + }; + }; + # Builds examples/roc-world/targets/wasm32/host.wasm in the current build # directory. The file is git-ignored, and the roc-world platform refuses to load # without it (src/world_compile.rs), so every derivation that runs the tests @@ -102,7 +155,7 @@ let hyperfine # Web development tools - bun # JavaScript bundler and runtime (required for web builds) + bunPinned # JavaScript bundler and runtime (required for web builds); pinned 1.4.5, see the let binding (#13337) typescript # TypeScript for type checking # nodepackages remoed 2026-04-03 wrangler # Cloudflare Worker CLI (worker-poc dev, #2271)