Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 bun2nix CLI with nothing but bunx 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

  • mkBunDerivation has been renamed and moved from inputs.bun2nix.${system}.mkBunDerivation to inputs.bun2nix.packages.${system}.default.mkDerivation (or more simply bun2nix.mkDerivation)
  • The index attribute has been renamed to module to be inline with how it's defined in packages.json.
  • Instead of specifying bunNix directly, specify bunDeps using fetchBunDeps instead.
  • See mkDerivation for other new features and examples

mkBunNodeModules

  • mkBunNodeModules has been removed entirely in favor of fetchBunDeps to build a bun compatible cache.
  • Still need to add node_modules/ to an arbitrary derivation? Have a look at the new bun2nix hook, which provides a much nicer API.

writeBunScriptBin

  • This has been moved from inputs.bun2nix.lib.${system}.writeBunScriptBin to inputs.bun2nix.packages.${system}.default.writeBunScriptBin

New bun.nix schema

  • Now consumable by pkgs.callPackage and bun2nix.fetchBunDeps.
  • Don't forget to rewrite your bun.nix file by running bun2nix -o bun.nix before use!