Skip to content

bun: init configHook & fetchDeps - #376299

Draft
eveeifyeve wants to merge 3 commits into
NixOS:masterfrom
eveeifyeve:bun-hooks
Draft

eveeifyeve wants to merge 3 commits into
NixOS:masterfrom
eveeifyeve:bun-hooks

Conversation

@eveeifyeve

@eveeifyeve eveeifyeve commented Jan 24, 2025 •

Copy link
Copy Markdown
Member

Adds bun.fetchDeps & bun.configHook to bun and updates bun to 1.2.
Blocked by Mic92/nix-update#557 for nix-update-script's.
This pr will lead up to the building bun from source.

NOTE: If you have something to say in this pr please think about if it's spam, off-topic, has already been said (which may have a comment about why I have resolved it) or would be preferred to be a message in matrix, before commenting as this pr. As this pr is becoming big with a lot of people subscribed and I am trying to keep it organized, maintained and not ping heavy.

All related issues that it closes:

closes #335534
closes #255890
closes #414837
closes #424038

This work is semi sponsored by DigitalBrewStudios.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions Bot added 8.has: documentation This PR adds or changes documentation 6.topic: nodejs Node.js is a free, open-source, cross-platform JavaScript runtime environment labels Jan 24, 2025
@nix-owners
nix-owners Bot requested a review from winterqt January 24, 2025 04:54
@eveeifyeve
eveeifyeve marked this pull request as draft January 24, 2025 04:57
@eveeifyeve

This comment was marked as spam.

@eveeifyeve

This comment was marked as outdated.

@github-actions github-actions Bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Jan 24, 2025
@eveeifyeve
eveeifyeve force-pushed the bun-hooks branch 2 times, most recently from 5b658cf to fac0e2a Compare January 24, 2025 05:12

@winterqt winterqt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To even begin reviewing this, this needs to be properly split up into multiple commits; ideally, the Bun upgrade would be done in a separate PR entirely.

@eveeifyeve

This comment was marked as outdated.

@eveeifyeve

This comment was marked as outdated.

@eveeifyeve

This comment was marked as outdated.

@eveeifyeve eveeifyeve changed the title bun: init configHook and fetchDeps; bun 1.1.43 -> 1.2.0 bun: init configHook and fetchDeps; bun 1.1.43 -> 1.2.0; bun: switch to finalAttrs from rec Jan 24, 2025
@eveeifyeve
eveeifyeve force-pushed the bun-hooks branch 3 times, most recently from a72a721 to 30e4175 Compare January 25, 2025 11:31
@eveeifyeve

This comment was marked as outdated.

@getchoo

getchoo commented Jan 27, 2025

Copy link
Copy Markdown
Member

I am still keeping this draft for now, because of one waiting for #376054 to merged

Merged

@RossSmyth

RossSmyth commented Feb 22, 2026 •

Copy link
Copy Markdown
Contributor

The FODs produced are not reproducible. The build fails if you do not have the FOD as it reports a different hash.

@RossSmyth RossSmyth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think very carefully about the public API. What should be able to be overriden? What shouldn't be? Making the public API as small as possible for the MVP is good because expanding it later is not a breaking change, while reducing it is.

Also giving this a try, the FODs are not reproducible as noted above.

Comment thread pkgs/by-name/bu/bun/hooks/default.nix Resolved
Comment thread pkgs/by-name/bu/bun/hooks/default.nix Resolved
Comment thread pkgs/by-name/bu/bun/hooks/default.nix Resolved
Comment thread pkgs/by-name/bu/bun/hooks/default.nix Resolved
Comment thread pkgs/by-name/bu/bun/hooks/default.nix Resolved
Comment thread pkgs/by-name/bu/bun/hooks/default.nix Outdated
dontConfigure = args'.dontConfigure or true;
dontFixup = args'.dontFixup or true;

inherit outputHash outputHashAlgo;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please actually think about this review instead of saying that is is complicated. It is making it more future-proof.

Comment thread pkgs/by-name/bu/bun/hooks/default.nix Resolved
Comment thread pkgs/by-name/bu/bun/hooks/default.nix Resolved
Comment thread pkgs/by-name/bu/bun/hooks/default.nix Resolved
@eveeifyeve

eveeifyeve commented Feb 22, 2026 •

Copy link
Copy Markdown
Member Author

The FODs produced are not reproducible. The build fails if you do not have the FOD as it reports a different hash.

For this I have the check with other apps that use bun and see if it's globally producing .npm files. Personally someone had a solution here, but I don't like the use of the arbitrary & seems malicious dd command personally, unless it's okay to use it for this case so I have asked @winterqt to review it, before I go ahead and add it.

There is also some known issues I am trying to fix before this like in the configHook it's not unpacking the tar correctly.

@kuflierl

kuflierl commented Feb 23, 2026 •

Copy link
Copy Markdown
Member

For this I have the check with other apps that use bun and see if it's globally producing .npm files. Personally someone had a solution here, but I don't like the use of the arbitrary & seems malicious dd command personally, unless it's okay to use it for this case so I have asked @winterqt to review it, before I go ahead and add it.

The dd command is just writing 4 bytes at offset 96 in the file. Which does fit very nicely with my diff where I found the difference at 0x60. This would be valid as long as we assume that the position of the timestamp is always at that static offset and that we are dealing with a 4 byte little endian encoded unix timestamp. Considering that there were 4 trailing 0 bytes, we might be dealing with an 8 byte value.

We definitely need to look into the binary format.

Also I don't expect the second command restoring the date to really work since it seems to try to read the current date via the date command.

Comment on lines +15 to +26
# `bunDeps` should be a tarball
unpackFile "$bunDeps"
bunDepsCopy="$(realpath "$(stripHash "$bunDeps")")"

echo "Configuring bun store"

HOME=$(mktemp -d)
BUN_INSTALL_CACHE_DIR=$(mktemp -d)
export HOME BUN_INSTALL_CACHE_DIR

cp -Tr "$bunDepsCopy" "$BUN_INSTALL_CACHE_DIR"
chmod -R +w "$BUN_INSTALL_CACHE_DIR"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why exactly are we creating 2 copies of the unpacked FOD? Couldn't we just unpack into a temp dir and point BUN_INSTALL_CACHE_DIR at it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs to first unpack the deps to $bunDeps and then next line stripes the hash before it can be copied to the BUN_INSTALL_CACHE_DIR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hold on, aren't we unpacking from bunDeps to the current working directory? The location of the folder is then stored in bunDepsCopy where the content is then copied to Bun_install_cache_Dir.

This seems a bit unnecessarily complicated.

Why not something like this:

HOME=$(mktemp -d)
pushd $(mktemp - d)
unpackFile "$bunDeps"
export BUN_INSTALL_CACHE_DIR="$(realpath "$(stripHash "$bunDeps")")"
popd

@eveeifyeve eveeifyeve Feb 23, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It supposed to be unpacking to $bunDeps. The reason as to why it's not is because it doesn't have a root dir. Please have a look at @getchoo review if your unsure.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which do you mean?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hold on, aren't we unpacking from bunDeps to the current working directory? The location of the folder is then stored in bunDepsCopy where the content is then copied to Bun_install_cache_Dir.

This seems a bit unnecessarily complicated.

Why not something like this:

HOME=$(mktemp -d)
pushd $(mktemp - d)
unpackFile "$bunDeps"
export BUN_INSTALL_CACHE_DIR="$(realpath "$(stripHash "$bunDeps")")"
popd

@kuflierl Does that even work?

fi

# `bunDeps` should be a tarball
unpackFile "$bunDeps"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Known problem: This is not unpacking to $bunDeps which is not correct in fetcher.

@PerchunPak

PerchunPak commented May 4, 2026 •

Copy link
Copy Markdown
Member

I couldn't find anything similar posted in this PR, so reposting it for visibility

When updating the packages, I noticed that it would sometimes provide two different hashes for the nodeModules derivation (limwa/nix-t3code@56d3754 and limwa/nix-t3code@aa0d965), which makes the derivation non-deterministic.

I downloaded the two nodeModules results and saw this:

❯ diff -r result-ojy result-ist
Only in result-ist/node_modules/.bun/[email protected]+044c74c876d36fc3/node_modules/.bin: browserslist

If I were to guess, I would say that this is happening because browserslist depends on update-browserslist-db, and update-browserslist-db declares a peer dependency on browserslist. And so, when Bun is generating the package-local .bin directory for update-browserslist-db, sometimes it links the peer binary browserslist -> ../browserslist/cli.js, sometimes it skips it.

I still don't know of a possible workaround...

EDIT: looks like there is a fix available upstream, still in a PR (oven-sh/bun#29014). Using the hoisted linker appears to work though.

Originally posted in #510466 (comment)

@m4r1vs m4r1vs mentioned this pull request May 7, 2026
5 of 13 tasks
@luvcie

luvcie commented May 15, 2026 •

Copy link
Copy Markdown

hi, I tried this on my own bun project (starmie-cli) which is a small CLI with just @pkmn/sim and 4 transitive dependencies (no native modules, no catalog, no peer dependencies). I thought a small one might be useful since most of the testing here has been on bigger packages.

Env: nixpkgs at 77139725dce1a5eb6a364d54aa12d7cb8524dced (bun-hooks branch), bun 1.3.11, x86_64-linux, sandbox on.

A couple of things I ran into.

hash = in the docs doesn't actually trigger FOD. The docs in doc/languages-frameworks/javascript.section.md show:

bunDeps = bun.fetchDeps {
  inherit (finalAttrs) pname version src;
  hash = "..."; # clear this and generate a new one
};

If you write it like that the build runs without network access and bun fails immediatly:

error: FailedToOpenSocket downloading tarball @pkmn/[email protected]
error: ConnectionRefused downloading tarball @pkmn/[email protected]
...

The derivation produced by bun.fetchDeps { ...; hash = "sha256-AAA..."; } has no outputHash set, so it's not actually a FOD and the sandbox blocks network. Looks like lib.extendMkDerivation doesn't map hash to outputHash here.

Switching to outputHash = "..."; outputHashAlgo = "sha256"; makes the fetch work fine.

Probably either map hash to outputHash somewhere in extendDrvArgs, or update the doc example to use outputHash. I saw @RossSmyth mention "just accept hash" further up which would be the nicer fix.

Once the fetch part works, the configHook fails with:

cp: cannot stat '/build/source/pokescope-0.1.0-bun-deps.tar.gz': No such file or directory

Same symptom as #3632939109 I think.

The hook does:

unpackFile "$bunDeps"
bunDepsCopy="$(realpath "$(stripHash "$bunDeps")")"
...
cp -Tr "$bunDepsCopy" "$BUN_INSTALL_CACHE_DIR"

But the tarball is built with tar -czf $out -C $BUN_INSTALL_CACHE_DIR ., so the contents are at the root of the archive (no wrapper directory). After unpackFile, the cache contents are already in cwd, but stripHash "$bunDeps" just returns the tarball's basename (pokescope-0.1.0-bun-deps.tar.gz) and realpath of that points to a file that doesnt exist. So cp fails.

Two ways out I can think of:

  • tar the cache into a wrapper directory in fetchDeps (so the stripHash name actually matches a directory after unpack)
  • or skip the realpath/stripHash part entirely and just copy from cwd, since unpackFile already put everything there

I went with the second one locally by inlining the configHook logic in a custom configurePhase (basically tar -xzf $bunDeps -C $BUN_INSTALL_CACHE_DIR && bun install --registry=http://localhost --ignore-scripts --linker=isolated --omit=dev --frozen-lockfile) and the rest of the build works fine.

Reproducibility looked fine on the same machine. Ran the dependencies tarball three times (deleted the output between runs) and once via nix-store --realise --check, got the same sha256-7r0CTrUO+bKgzXgYij1Gq+9ycbCsoQJzPQKz1R1wMvw= each time. I didn't test cross-machine so this is way less solid than the cup-docker cross-machine experiments earlier in the thread.

Also, pokescope's dependency tree doesn't include update-browserslist-db so the peer-dependency .bin symlink issue from #4369911188 can't fire here, and with only 5 packages there isn't realy enough going on to hit the .npm timestamp non-determinism @soyouzpanda was looking at. Doesn't really say anything about the bigger reproducibility issues, just a small case where those edge cases don't come up.

oh and also, the docs show bunInstallFlags as an arg to bun.fetchDeps:

bunInstallFlags = [ "--shamefully-hoist" ];
bunDeps = bun.fetchDeps {
  inherit (finalAttrs) bunInstallFlags;
};

But in pkgs/by-name/bu/bun/hooks/default.nix the arg name on fetchDeps is actually installFlags. bunInstallFlags only gets read by the configHook (at install time, not fetch time). Probably just want to rename one so they match.

Flake I used for the test: https://github.com/luvcie/starmie-cli/tree/spike/bun-fetchdeps

@Adda0 Adda0 mentioned this pull request May 21, 2026
13 tasks
@eveeifyeve

Copy link
Copy Markdown
Member Author

I will be working on this again, thanks for everyone patience. I am working on a script in rust to handle the fetching which is what I assume @hsjobeki means for splitting the FOD part. Overall later on IMO, It would be good to ideally integrate this support into prefetch-npm-deps, but that is a separate topic and should be done in another pr/issue.

@Malix-Labs

Copy link
Copy Markdown
Member

@eveeifyeve do you need help?

Do you know if the Bun v1.4.0 rewrite in Rust would break anything?

@eveeifyeve

Copy link
Copy Markdown
Member Author

@eveeifyeve do you need help?

I should be alright, however we can jump in a matrix call about this if you want? I will be home around 10am AEDT.

Do you know if the Bun v1.4.0 rewrite in Rust would break anything?

It helps more than anything. As we can refer some of the type to bun's crates.

@eveeifyeve eveeifyeve Aug 20, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be wise to move all this upstream to pkgs/build-support/node instead of a folder in bun?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I can't say anything authoritatively, the yarn hooks are a relatively new addition that ended up there. You might be able to find more information by looking at the PR history for them.

@itzTheMeow

Copy link
Copy Markdown
Contributor

in addition to bun's offline deps support the new v1.4.4 has a cache pack/unpack command which may solve some of the hash-churn issues

Co-authored-by: Winter <[email protected]>
Co-authored-by: Seth Flynn <[email protected]>
Co-authored-by: kuflierl <[email protected]>

Assisted-by: qwen/qwen3-coder-30b-a3b-instruct
Assisted-by: z-ai/glm-5.3-flash

@nixpkgs-ci nixpkgs-ci Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing to the documentation.

Follow the documentation style guide, especially:

  • Show, don’t tell. Start with a minimal working example. Explain after the code.
  • Avoid meta-commentary. Don’t write "This section explains how to…".
  • Use present tense, imperative mood, and active voice. For example: "Run the command," not "The user should run the following command."
  • Avoid vague references like "this" when the referent is unclear. Write "This command creates a folder," not "This will create a folder."
  • Be direct. Avoid "should", "might", "typically", and "usually".
  • Cut filler words like "simply", "just", "easily", and "basically". Use "to" instead of "in order to".

For larger changes, such as adding or removing whole sections, ask the NixOS documentation team for review.

@eveeifyeve

Copy link
Copy Markdown
Member Author

in addition to bun's offline deps support the new v1.4.4 has a cache pack/unpack command which may solve some of the hash-churn issues

The problem still occurs when you update bun.

@itzTheMeow

itzTheMeow commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

The problem still occurs when you update bun.

I had an AI figure this out for one of my projects a while back. Using bun v1.4.4, and the bun pm cache pack and bun pm cache unpack commands:

  1. set HOME/BUN_INSTALL_CACHE_DIR
  2. strip pre/postinstall scripts from package.json
  3. bun install --frozen-lockfile --ignore-scripts --no-progress
  4. pack the bun deps to a temporary file - bun pm cache pack "$TMPDIR/pack.bin"
  5. set directory to restore to - export BUN_INSTALL_CACHE_DIR="$TMPDIR/restore"
  6. unpack deps to that directory - bun pm cache unpack "$TMPDIR/pack.bin"
  7. sanitize the symlinks produced from the pack - bun "${./sanitize.ts}" "$BUN_INSTALL_CACHE_DIR" (see POC)

the pack/unpack round-trip makes the dependencies byte-reproducible
the pack file itself contains absolute path symlinks that contain the path of the build directory
unpacking it still produces the same symlinks but the files are now byte-reproducible (no timestamp workaround needed like in earlier threads)
example, before:
lrwxrwxrwx 1 xela users 38 Nov 23 02:49 '1.4.2@@@1' -> '/tmp/xxx/@1password/[email protected]@@@1'/

the sanitizer rewrites the symlinks to be relative paths instead:
lrwxrwxrwx 2 root root 17 Dec 31 1969 '2.9.1@@@1' -> '../[email protected]@@@1'/
which makes them also reproducible

i had the same AI extract it from my personal project and make a small POC using opencode's dependency tree
https://github.com/itzTheMeow/temp-nixpkgs-poc
Assisted-by: OpenCode (GLM 5.3 Flash)
obviously wouldn't expect this to be copied verbatim, but it gets the point across
really the only important files are bun/cache.nix and bun/sanitize.ts

not sure how this fits into the existing work, but i figured i would share a POC for at least the dependency reprod part
this still requires the dependency hashes to be per-system

this does require bun 1.4.4 for the pm cache commands, which looks like its in unstable already

@DuskyElf DuskyElf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head 4029d42. I did not build this locally. The PR is a draft, doc/redirects.json conflicts with master, and the current nixpkgs run fails Eval on all three systems at the merge commit, so there is no clean build signal yet.

The main thing I would fix first is the split between the fetcher and the hook. prefetch-bun-deps writes an npm registry mirror (<package>/manifest.json plus <package>/-/<tarball>). bunConfigHook copies that tree into BUN_INSTALL_CACHE_DIR and runs bun install --offline. Bun's cache holds extracted name@version directories, not packuments (global cache docs). The HTTP server that could serve the mirror is in src/main.rs (handle_connection and route), but TcpListener is only imported and no listener is started. The two halves do not connect. The bun pm cache pack and unpack route in the latest comment could replace much of this custom fetcher.

Smaller findings:

  • bun-config-hook.sh runs patchShebangs node_modules/{*,.*}. Bash expands .* to . and .., so this also patches the whole source tree one level up.
  • src/main.rs accepts sha384- integrity strings in integrity(), but verify_sri() handles only sha512 and sha1. A sha384 lockfile entry fails late with "unsupported SRI algorithm".
  • hooks/default.nix passes bunInstallFlags, preBunInstall, os and cpu through fetchDeps, but the fetcher only runs prefetch-bun-deps. The docs claim preBunInstall runs in both hooks, which is not true. --shamefully-hoist in the docs is a pnpm flag.
  • hooks/default.nix propagates prefetch-bun-deps from configHook, so every package using bun builds a Rust binary it never runs. Only the fetcher needs it.
  • opencode/package.nix and opencode-desktop/package.nix still have hash = ""; Nix reports a hash mismatch until those are filled in.

I can look again once the conflict and hashes are settled.

@TheRealGramdalf TheRealGramdalf left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small tweaks I noticed.

Regarding cache pm, I can say from experience with bun2nix that if you use a custom program to manipulate the cache, you should be prepared for it to break on updates and require fixing relatively often. If the cache pm commands work then those would likely be less of a maintenance burden. The only downside I can see is that if upstream breaks those commands, there may not be an easy fix/it may require blocking a bun update till a further release or something like that.

Edit to prevent pings: As long as you're good with the maintenance required it's a non issue as far as I'm concerned, just wanted to give my 2c


bunDeps = bun.fetchDeps {
inherit (finalAttrs) pname version src;
hash = "..."; # clear this and generate a new one

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is left completely empty, shouldn't nix assume a fake hash? Or does that only apply to certain fetchers?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is left completely empty, shouldn't nix assume a fake hash? Or does that only apply to certain fetchers?

I'm pretty certain that some fetchers require one to provide fake hash because they don't assume that for an empty field.

Comment on lines +643 to +659
If you require changing a Bun configuration setting (such as `--dry-run` or similar),
set `preBunInstall` to the right commands to run. For example:

```nix
{
preBunInstall = ''
--dry-run
'';
bunDeps = bun.fetchDeps {
inherit (finalAttrs) preBunInstall;
#...
};
}
```

In this example, `preBunInstall` will be run by both `bun.configHook` and by the `bun.fetchDeps` builder.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems weird to me. preBunInstall sounds like it's defining an entire phase, not arguments passed to specific commands. Shouldn't this be named something else and utilize __structuredattrs?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using convention from other packages, this could be something like extraBunFlags?

@itzTheMeow

itzTheMeow commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Regarding cache pm, I can say from experience with bun2nix that if you use a custom program to manipulate the cache, you should be prepared for it to break on updates and require fixing relatively often. If the cache pm commands work then those would likely be less of a maintenance burden. The only downside I can see is that if upstream breaks those commands, there may not be an easy fix/it may require blocking a bun update till a further release or something like that.

The application i bundle with the cache pm commands has a lot of custom package patches and local workspace packages and it all works fine through the cache commands, so fairly complex packages/dependencies should be simple.

@eveeifyeve

Copy link
Copy Markdown
Member Author

Some small tweaks I noticed.

Regarding cache pm, I can say from experience with bun2nix that if you use a custom program to manipulate the cache, you should be prepared for it to break on updates and require fixing relatively often. If the cache pm commands work then those would likely be less of a maintenance burden. The only downside I can see is that if upstream breaks those commands, there may not be an easy fix/it may require blocking a bun update till a further release or something like that.

It's not that there is a chance for it upon a new bun release to become reproducible and invalidate the cache, see #376299 (comment) for more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: nodejs Node.js is a free, open-source, cross-platform JavaScript runtime environment 8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.

Projects

Status: 👀 To Review

Development

Successfully merging this pull request may close these issues.

bun.fetchDeps & bun.ConfigHook Package request: buildBunModule