node-env: use upstream version

This commit is contained in:
Nikolay Amiantov 2017-01-04 02:51:01 +03:00
parent 6b504f8b52
commit 40a9c37ff3
1 changed files with 61 additions and 48 deletions

View File

@ -123,7 +123,7 @@ let
if [ -f "${src}" ]
then
# Figure out what directory has been unpacked
packageDir=$(find . -type d -maxdepth 1 | tail -1)
packageDir="$(find . -maxdepth 1 -type d | tail -1)"
# Restore write permissions to make building work
find "$packageDir" -type d -print0 | xargs -0 chmod u+x
@ -133,11 +133,18 @@ let
mv "$packageDir" "$DIR/${packageName}"
elif [ -d "${src}" ]
then
# Get a stripped name (without hash) of the source directory.
# On old nixpkgs it's already set internally.
if [ -z "$strippedName" ]
then
strippedName="$(stripHash ${src})"
fi
# Restore write permissions to make building work
chmod -R u+w $strippedName
chmod -R u+w "$strippedName"
# Move the extracted directory into the output folder
mv $strippedName "$DIR/${packageName}"
mv "$strippedName" "$DIR/${packageName}"
fi
# Unset the stripped name to not confuse the next unpack step
@ -207,6 +214,9 @@ let
if [ "$dontNpmInstall" != "1" ]
then
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
rm -f npm-shrinkwrap.json
npm --registry http://www.example.com --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install
fi
@ -263,10 +273,13 @@ let
# calling executables outside the Nix store as much as possible
patchShebangs .
export HOME=$TMPDIR
export HOME=$PWD
npm --registry http://www.example.com --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild
${stdenv.lib.optionalString (!dontNpmInstall) ''
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
rm -f npm-shrinkwrap.json
npm --registry http://www.example.com --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install
''}