Repository navigation
bun: build from source - #555390
bun: build from source#5553909bingyin wants to merge 13 commits into
Conversation
|
|
|
|
❌
|
5c4a042 to
eaf7276
Compare
❌
|
7b33d79 to
27974ca
Compare
❌
|
|
Any progress on this? Bun 1.4.3 is already out and this could really improve the delivery of bun in nixpkgs. |
I see. I'll follow up once #569018 lands on master |
5ee0d33 to
3903fb7
Compare
|
@9bingyin What is remaining for this PR to be taken out of draft and marked ready for review? I would be glad to help in any way I can. |
ccf3190 to
9e1ce7a
Compare
Because the build process kept changing substantially across the next few minor releases after Bun's migration to Rust, I left this PR in draft for the time being. It might be a good time to pick it back up now, though. |
Assisted-by: pi (GPT-5.6 Sol)
- add bun-unwrapped with fixed Bun, WebKit, Cargo and node module sources - keep bun as a lightweight wrapper for Linux compilation paths - add an update script and propagate ICU for compiled executables Assisted-by: pi (GPT-5.6 Sol)
Apply Bun's __DATA_DIRTY segment workaround to native Darwin builds. This keeps __BUN immediately before __LINKEDIT so standalone module graphs larger than 16 KiB do not fail with OverlappingSegments. oven-sh/bun#40107 Assisted-by: pi (GPT-5.6 Sol)
- move source pins to a generated sources.json - stop modifying Nix expressions with regular expressions - write updater output atomically - limit passthru to the supported public attributes - preserve the existing package description Assisted-by: pi (GPT-5.6 Sol)
Update pinned sources to 1.4.2. Move compiler and linker flags out of the patches into NIX_CFLAGS_COMPILE and NIX_LDFLAGS, which removes the need for fix-darwin-standalone-segment-order.patch. Restore the upstream jsc target with readline and libedit on Darwin. Regenerate both patches with git against the pinned source. update.py now runs on the current platform, and the package follows the default llvmPackages. Assisted-by: pi (Muse Spark 1.3)
Build Bun's pinned WebKit fork in a private derivation and pass it to Bun through BUN_WEBKIT_DIR. Reject WebKit store references in the Bun output. Assisted-by: pi (GPT-5.6 Sol)
Select the bootstrap, node modules, and host compilers for buildPlatform. Pass Bun the target Linux OS, CPU, and ABI while Nix's compiler wrappers provide the sysroot. Update the script to select musl bootstrap assets and note the settings that follow Bun's build files. Assisted-by: pi (GPT-5.6 Sol)
Supply standard-library sources and vendor dependencies for Bun's new Rust build graph. Adapt type reflection for Rust 1.99. Disable WebKit PCH on Darwin with Clang 21. Disable whole-program vtable optimization for non-LTO WebKit. Add upstream Rust and offline runtime tests. https://bun.com/blog/bun-v1.4.3 Assisted-by: pi (GPT-6.1 Sol)
Use Nix-provided codesign and codesign_allocate instead of the host /usr/bin/codesign when signing jsc. Assisted-by: pi (GPT-6.1 Sol)
Set WebKit's macOS deployment target and implement Start's Default for Rust 1.99. https://bun.com/blog/bun-v1.4.4 Assisted-by: pi (GPT-6.1 Sol)
https://bun.com/blog/bun-v1.4.5 Assisted-by: pi (GPT-6.2 Sol)
73d6aff to
7fea455
Compare
| installShellCompletion --cmd bun \ | ||
| --bash completions/bun.bash \ | ||
| --fish completions/bun.fish \ | ||
| --zsh completions/bun.zsh |
There was a problem hiding this comment.
installShellCompletion should be conditional on stdenv.buildPlatform.canExecute stdenv.hostPlatform. For an example, see https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/es/espflash/package.nix?rgh-link-date=2026-11-16T03%3A19%3A20.000Z#L40.
There was a problem hiding this comment.
espflash needs canExecute because it runs $out/bin/espflash to generate completions. In bun-unwrapped, the files under completions/ are static files in the source tree. installShellCompletion copies them and does not run the built binary.
There was a problem hiding this comment.
Whoops. You are completely right. Thank you for correcting my misunderstanding!
Assisted-by: Antigravity CLI (Gemini 4 Neon)
Bun 1.4 moves much of Bun's implementation from Zig to Rust, and upstream changed the build process at the same time. The existing nixpkgs package installed Bun's release binary, so I used this update to try building Bun from source instead.
The source build lives in
bun-unwrapped. It pins the Bun and WebKit revisions, Cargo dependencies, Node modules, and the native source archives used by Bun's build system. An upstream Bun binary is still needed to bootstrap the build, but the final executable is built from source. Thebunpackage wrapsbun-unwrappedwith the include and library paths needed bybun build --compileon Linux.This should also address the
pkgsMusl.bunfailure tracked in #280716. UnderpkgsMusl, the package now uses Bun's musl bootstrap and builds the final executable with the musl toolchain instead of trying to adapt a glibc release binary.This is my first contribution to nixpkgs, so corrections are welcome if I have missed a convention. I use Bun and would be happy to help maintain the package. This PR adds me to its maintainer list.
https://bun.com/blog/bun-v1.4.4
Assisted-by: pi (GPT-5.6 Sol)
Assisted-by: pi (GPT-6.1 Sol)
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.