Node

@todo https://forum.holochain.org/t/im-spinning-up-some-docs-for-holonix-feedback-welcome/451/12?u=thedavidmeister

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.

ghost/default.nix

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

This pattern might be formalised in holonix itself sometime: https://github.com/holochain/holonix/issues/51