Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

13 Commits

Repository files navigation

Nix Flake · Node.js Dev Template

purr · git-hooks · nodejs · corepack · bun · direnv · nix-flake

Nix flake template for Node.js development — reproducible dev shell with Node.js runtime, Bun, Deno, unified package manager CLI (ni), and git pre-commit hooks. Built on purr and git-hooks.nix.

Part of the develop-templates collection (nix flake init-ready).

Quick Start

nix flake init

nix flake init -t "github:nixcafe/develop-templates#node" --refresh

Register an alias:

nix registry add beans "github:nixcafe/develop-templates"
nix flake init -t beans#node

Tip: With cattery-modules, beans is pre-registered.

Create from Template

gh repo create my-node-project --template nixcafe/node --clone

Enter the Dev Shell

direnv allow
# bootstrap & install deps
ni init
ni add express

What's Inside

ToolPurpose
nodeNode.js runtime
corepackpnpm / yarn package manager manager
ni / nr / nlx / nun / nci@antfu/ni — unified package manager CLI
bunBun JavaScript runtime & bundler
denoDeno JavaScript/TypeScript runtime

node_modules/.bin is auto-added to PATH when it exists.

Customizing

Enable pre-commit hooks

Edit develop/checks/git-hooks/default.nix — all hooks are disabled by default:

hooks={biome.enable=true;# eslint.enable = true;# denofmt.enable = true;};

See git-hooks.nix for the full hook catalog.

Pin a specific Node.js version

# flake.nixoutputs=inputs:
inputs.purr.lib.mkFlake{inheritinputs;src=./develop;override=final: prev: {nodejs=final.nodejs_22;};};

Add system packages

# develop/shells/default/default.nixpackages=withpkgs;[nodecorepackffmpegopenssl];

Project Structure

.
├── flake.nix
├── .envrc
├── .gitignore
└── develop/
├── shells/
│ └── default/
│ └── default.nix
└── checks/
└── git-hooks/
└── default.nix

About

Nix flake Node.js development template — reproducible dev shell with Node.js, Corepack, Bun, Deno, and git pre-commit hooks

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

Generated from nixcafe-develop/nix