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

From A Template

By default 2 templates are offered for starting off a new project with bun2nix enabled by default:

  • A minimal hello world binary program - the default.
  • A basic react website and server setup.

Notable files

The main files of note are:

  • flake.nix ⇒ Contains basic project setup for a nix flake for bun2nix
  • default.nix ⇒ Contains build instructions for this bun package
  • bun.nix ⇒ Generated bun expression from bun.lock
  • package.json ⇒ Standard JavaScript package.json with a postinstall script pointing to bun2nix

Default - Minimal Setup

To produce the default minimal sample, run:

nix flake init -t github:baileyluTCD/bun2nix

This is a bare-bones project created via bun init which produces a simple hello world binary packaged via bun2nix.

React Website

To start with the React website template run

nix flake init -t github:baileyluTCD/bun2nix#react

This is a simple example of a basic React app built through bun2nix.