From a6ec30327f3586509a2d78b641bbf5832d21b592 Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Mon, 23 Nov 2026 21:51:00 +0000 Subject: [PATCH 1/2] fix(nix): scope pristine bun to dev shells; sandbox checks use nixpkgs bun (#13751) The pristine upstream bun 1.4.5 binary (#13337) needs the system loader (/lib64/ld-linux), which does not exist in the nix build sandbox, so it cannot execute there. It was added to the shared nativeBuildInputs, so the bun2nix hook resolved bun to it in every check derivation and ~35 checks failed with exit 127 ('cannot execute: required file not found') in nix flake check on main (run 45260211824). The shared set now carries the patchelf'd nixpkgs bun, which works in the sandbox; dev shells swap it for the pristine build via shellNativeBuildInputs, preserving the #13337 vitest fix on fleet hosts where the loader exists. Formatting drift (prettier/biome/rustfmt/statix, exit 1) is a separate root cause and stays for a follow-up slice. --- pkgs/id/flake.nix | 4 +++- pkgs/id/nix-common.nix | 26 ++++++++++++++++++++++---- pkgs/id/shell.nix | 5 ++++- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/pkgs/id/flake.nix b/pkgs/id/flake.nix index e7a6e7e23b..0f655f5d3c 100644 --- a/pkgs/id/flake.nix +++ b/pkgs/id/flake.nix @@ -342,7 +342,9 @@ # Development shell: nix develop devShells.default = pkgs.mkShell { inherit buildInputs; - inherit nativeBuildInputs; + # Pristine bun for the shell (#13337); the shared set carries + # the patchelf'd nixpkgs bun for the sandbox (#13751). + nativeBuildInputs = nixCommon.shellNativeBuildInputs; inherit (nixCommon) shellHook TREEFMT_TREE_ROOT_CMD; inherit (opensslEnv) OPENSSL_DIR; diff --git a/pkgs/id/nix-common.nix b/pkgs/id/nix-common.nix index 7e118d8d0d..6ccd8b5a82 100644 --- a/pkgs/id/nix-common.nix +++ b/pkgs/id/nix-common.nix @@ -38,7 +38,12 @@ let # 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. + # update alone. Shells only, strictly: the pristine binary cannot + # execute in the nix build sandbox (no /lib64/ld-linux there), so + # putting it in the shared nativeBuildInputs broke every check + # that runs bun (~35 exit-127 failures in nix flake check, + # #13751). The shared set carries the patchelf'd pkgs.bun; + # shellNativeBuildInputs swaps it for bunPinned. bunPinned = let zips = { @@ -155,7 +160,11 @@ let hyperfine # Web development tools - bunPinned # JavaScript bundler and runtime (required for web builds); pinned 1.4.5, see the let binding (#13337) + # bun, not bunPinned: sandbox derivations need the patchelf'd + # nixpkgs build — the pristine binary cannot execute without + # the system loader, which the sandbox lacks (#13751). Shells + # get bunPinned via shellNativeBuildInputs (#13337). + bun # JavaScript bundler and runtime (required for web builds) typescript # TypeScript for type checking # nodepackages remoed 2026-04-03 wrangler # Cloudflare Worker CLI (worker-poc dev, #2271) @@ -167,12 +176,21 @@ let # Manual linters (not in treefmt, run manually) deadnix ]); + + # Dev-shell inputs: the shared set with the pristine bun (#13337) + # swapped in for the nixpkgs bun. Shells run on fleet hosts, where + # the system loader exists and the repacked bun segfaults vitest; + # sandbox derivations must never see bunPinned (#13751). + shellNativeBuildInputs = map ( + p: if p == pkgs.bun then bunPinned else p + ) nativeBuildInputs; in { inherit rustToolchain fmtBins nativeBuildInputs + shellNativeBuildInputs rocCompiler buildWasmHost ; @@ -200,8 +218,8 @@ in # (just recipes and nix fmt use explicit --config-file/--tree-root instead) TREEFMT_TREE_ROOT_CMD = "pwd"; - # Packages for shell.nix / nix develop (nativeBuildInputs = all tools) - packages = nativeBuildInputs; + # Packages for shell.nix / nix develop (shell inputs = all tools) + packages = shellNativeBuildInputs; # OpenSSL environment variables opensslEnv = { diff --git a/pkgs/id/shell.nix b/pkgs/id/shell.nix index 74e9028e1e..09ce12cf8f 100644 --- a/pkgs/id/shell.nix +++ b/pkgs/id/shell.nix @@ -45,10 +45,13 @@ pkgs.mkShell { inherit (nixCommon) buildInputs shellHook - nativeBuildInputs TREEFMT_TREE_ROOT_CMD ; + # Pristine bun for the shell (#13337); the shared set carries the + # patchelf'd nixpkgs bun for the sandbox (#13751). + nativeBuildInputs = nixCommon.shellNativeBuildInputs; + # OpenSSL configuration for native builds inherit (nixCommon.opensslEnv) OPENSSL_DIR From 9b2728a25617bff95d679bf6e90418a963809d51 Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Mon, 23 Nov 2026 22:11:36 +0000 Subject: [PATCH 2/2] fixup: nixfmt the shellNativeBuildInputs line (#13751) --- pkgs/id/nix-common.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/id/nix-common.nix b/pkgs/id/nix-common.nix index 6ccd8b5a82..48ed507dba 100644 --- a/pkgs/id/nix-common.nix +++ b/pkgs/id/nix-common.nix @@ -181,9 +181,7 @@ let # swapped in for the nixpkgs bun. Shells run on fleet hosts, where # the system loader exists and the repacked bun segfaults vitest; # sandbox derivations must never see bunPinned (#13751). - shellNativeBuildInputs = map ( - p: if p == pkgs.bun then bunPinned else p - ) nativeBuildInputs; + shellNativeBuildInputs = map (p: if p == pkgs.bun then bunPinned else p) nativeBuildInputs; in { inherit