Repository navigation
buildBunModules: init - #221981
buildBunModules: init#221981jcouyang wants to merge 4 commits into
Conversation
|
Adding @winterqt and @lilyinstarlight as they have (legendary) experience with Node.js ecosystem and Bun is probably sharing some of the Node.js heritage in their build system. |
|
hey, this is looking quite good! |
|
This looks good |
winterqt
left a comment
There was a problem hiding this comment.
We more or less can't rely on the content of node_modules directory itself.
Take a look at how buildNpmPackage is implemented -- we implement a custom fetcher that creates a known-deterministic tree of the required dependencies.
I'm not sure how feasible this will be with bun, though, but I'm afraid this can't be merged in its current state.
Also, this isn't how FODs work at all, and the implementation doesn't provide support for something that reads the lockfile directly. |
|
The lockb file is a binary file, so I see the chances of parsing it as relatively low. @winterqt you are saying that the contents of the node_modules directory are not deterministic, so we can't rely on it, the vendorHash would potentially change. Did I understand right ? |
|
It's possible to build a yarn lockfile alongside I'd rather we didn't have to resort to such things and could handle the default case (handle lockb files). Fortunately, running They suggest using this for git diffing. |
|
That could be the way forward for now. |
the lockfile itself is executable as well, though probably should stick with
you're probably blocked on a yarn2nix refresh, there are a lot of open issues around it... |
|
I was thinking about a similar method than what is used here. |
for clarity: do you mean you intend to remove bun from the installation process? so use it to get the locked deps but then only use yarn? |
|
I think we should close this PR and open an issue for discussion. I think it's fairly clear that this PR won't be seeing any more work, especially since we haven't decided on how this should be implemented. |
|
let's use this issue if this works for you #255890 |
Description of changes
Added
buildBunModulesto help build Bun project with nixHere is a very simple example of how to package a hono service in bun:
Obviously
pname,versionandsrcare mandatory, wherevendorSha256is the calculated hash ofnode_modules, left this empty if don't wish to verify vendor packages' integrity by nix, e.g. if you havebun.lockbalready, which verify and lock all packages.Other optional attributes you can provide are:
prod: default totrue, only install production dependencies usingbun install --production, otherwise install all dependencies.bunlock: default tosrc + "./bun.lockb", please specify if you have bunlock in other location.Run the test:
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)