Open thomasjm opened 3 years ago
I've implemented my own implementation that does not rely on jq
or examining the package.json
config. I think this should work because references in bin/ always resolve to paths installed in the same output Nix store path.
I'm still validating whether this does not introduce new problems.
I was able to package my npm-based piece of software only with this patch. Would be great to have this merged!
Just wanted to check @svanderburg, is this fixed now? I'll close the PR if so.
I needed to do this so that a call to
node-gyp-build
would work in one of my dependencies.Sometimes a dependency comes with an executable script, which ultimately gets symlinked into
node_modules/.bin
. The existingpatchShebangs
call at the beginning ofprepareAndInvokeNPM
doesn't always catch these, because they don't always have the executable bit set. As a result, you get a failure in the Nix build because/usr/bin/env node
doesn't exist.So, this PR uses
jq
to traverse thebin
field ofpackage.json
, turning these files executable and patching them as necessary.This PR also exposes the
preRebuild
hook forbuildNodeDependencies
, and by extension for theshell
attribute. I think this will resolve #226.