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

The Command Line Tool

The recommended way to use bun2nix is by adding it to your package.json to automatically run after any package management option:

"scripts": {
    "postinstall": "bun2nix -o bun.nix"
}

However, if you run without the -o flag it will produce a text output over stdout similar to other lang2nix tools, hence if you enforce formatting rules in your repository it is likely a good idea to pass it through a formatter before writing the file.

Options

Currently, the options available from the command line tool are as follows:

Convert Bun (v1.2+) packages to Nix expressions

Usage: bun2nix [OPTIONS]

Options:
  -l, --lock-file <LOCK_FILE>      The Bun (v1.2+) lockfile to use to produce the Nix expression [default: ./bun.lock]
  -o, --output-file <OUTPUT_FILE>  The output file to write to - if no file location is provided, print to stdout instead
  -h, --help                       Print help
  -V, --version                    Print version