V2 Release Guide
bun2nix V2 comes with many improvements, including:
- Guaranteed correct bun installs via building the bun cache instead of creating the
node_modules/directory manually - Faster incremental builds via better caching
- Rewritten nix API designed to be both more idiomatic and flexible
- New NPM packaged web assembly CLI - run the
bun2nixCLI with nothing butbunx bun2nix- see the NPM page. - Now supports more of bun's dependency types, including:
- Files and symlinks
- Tarballs
- Git Dependencies
This work was done under Fleek. Please, check us out, especially if you are interested in Nix!
Updating
Below is a guide to all the breaking changes:
mkBunDerivation
mkBunDerivationhas been renamed and moved frominputs.bun2nix.${system}.mkBunDerivationtoinputs.bun2nix.packages.${system}.default.mkDerivation(or more simplybun2nix.mkDerivation)- The
indexattribute has been renamed tomoduleto be inline with how it's defined inpackages.json. - Instead of specifying
bunNixdirectly, specifybunDepsusingfetchBunDepsinstead. - See
mkDerivationfor other new features and examples
mkBunNodeModules
mkBunNodeModuleshas been removed entirely in favor offetchBunDepsto build a bun compatible cache.- Still need to add
node_modules/to an arbitrary derivation? Have a look at the newbun2nixhook, which provides a much nicer API.
writeBunScriptBin
- This has been moved from
inputs.bun2nix.lib.${system}.writeBunScriptBintoinputs.bun2nix.packages.${system}.default.writeBunScriptBin
New bun.nix schema
- Now consumable by
pkgs.callPackageandbun2nix.fetchBunDeps. - Don't forget to rewrite your
bun.nixfile by runningbun2nix -o bun.nixbefore use!