From b73021a475f7f2a2eac7946972241c30eeceaf1c Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Thu, 18 Jul 2013 15:44:48 -0400 Subject: [PATCH] buildNodePackage: Handle all node/coffee shebang possibilities Signed-off-by: Shea Levy --- pkgs/development/web/nodejs/build-node-package.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/web/nodejs/build-node-package.nix b/pkgs/development/web/nodejs/build-node-package.nix index 1e6d5cc6bcac..415f2209597c 100644 --- a/pkgs/development/web/nodejs/build-node-package.nix +++ b/pkgs/development/web/nodejs/build-node-package.nix @@ -42,8 +42,14 @@ stdenv.mkDerivation ({ mv node_modules $out/node_modules/${requireName} if [ -d "$out/node_modules/.bin" ]; then ln -sv node_modules/.bin $out/bin + node=`type -p node` + coffee=`type -p coffee || true` find -L $out/node_modules/.bin/* -type f -print0 | \ - xargs -0 sed --follow-symlinks -i 's@#!/usr/bin/env node@#!${nodejs}/bin/node@' + xargs -0 sed --follow-symlinks -i \ + -e 's@#!/usr/bin/env node@#!'"$node"'@' \ + -e 's@#!/usr/bin/env coffee@#!'"$coffee"'@' \ + -e 's@#!/.*/node@#!'"$node"'@' \ + -e 's@#!/.*/coffee@#!'"$coffee"'@' fi if [ -e "$out/node_modules/${requireName}/man" ]; then mkdir $out/share