npm binaries

There is a conflict with the PATH handling of npm.

When binaries are added to ./node_modules/.bin the default behaviour of npm run is to symlink them somewhere on the PATH outside the current repository.

Other tools that work with npm managed binaries such as npx do something similar.

This is incompatible with holonix for two reasons:

A simple workaround is to “wrap” node binaries in a nixified bash script and pass cli arguments verbatim.

For example, the ghost blogging platform normally expects to be installed globally with npm install -g ghost but can be wrapped locally in a nix shell.


{ pkgs }:
  bin-name = "ghost";
  wrapper =  pkgs.writeShellScriptBin bin-name ''
   set -euo pipefail
   ./node_modules/.bin/${bin-name} "$@"
 buildInputs = [

This pattern might be formalised in holonix itself sometime: