node-env: use upstream version
This commit is contained in:
parent
6b504f8b52
commit
40a9c37ff3
@ -123,7 +123,7 @@ let
|
|||||||
if [ -f "${src}" ]
|
if [ -f "${src}" ]
|
||||||
then
|
then
|
||||||
# Figure out what directory has been unpacked
|
# 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
|
# Restore write permissions to make building work
|
||||||
find "$packageDir" -type d -print0 | xargs -0 chmod u+x
|
find "$packageDir" -type d -print0 | xargs -0 chmod u+x
|
||||||
@ -133,11 +133,18 @@ let
|
|||||||
mv "$packageDir" "$DIR/${packageName}"
|
mv "$packageDir" "$DIR/${packageName}"
|
||||||
elif [ -d "${src}" ]
|
elif [ -d "${src}" ]
|
||||||
then
|
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
|
# 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
|
# Move the extracted directory into the output folder
|
||||||
mv $strippedName "$DIR/${packageName}"
|
mv "$strippedName" "$DIR/${packageName}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Unset the stripped name to not confuse the next unpack step
|
# Unset the stripped name to not confuse the next unpack step
|
||||||
@ -207,6 +214,9 @@ let
|
|||||||
|
|
||||||
if [ "$dontNpmInstall" != "1" ]
|
if [ "$dontNpmInstall" != "1" ]
|
||||||
then
|
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
|
npm --registry http://www.example.com --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -263,10 +273,13 @@ let
|
|||||||
# calling executables outside the Nix store as much as possible
|
# calling executables outside the Nix store as much as possible
|
||||||
patchShebangs .
|
patchShebangs .
|
||||||
|
|
||||||
export HOME=$TMPDIR
|
export HOME=$PWD
|
||||||
npm --registry http://www.example.com --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild
|
npm --registry http://www.example.com --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild
|
||||||
|
|
||||||
${stdenv.lib.optionalString (!dontNpmInstall) ''
|
${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
|
npm --registry http://www.example.com --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install
|
||||||
''}
|
''}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user