Merge pull request #111247 from siraben/stdenv-lib-node-env

pkgs/development: stdenv.lib -> lib in node-composition files
This commit is contained in:
Jörg Thalheim 2021-01-30 08:40:47 +00:00 committed by GitHub
commit fd2dcf3b17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 83 additions and 83 deletions

View File

@ -6,7 +6,7 @@
let let
nodeEnv = import ../../../../development/node-packages/node-env.nix { nodeEnv = import ../../../../development/node-packages/node-env.nix {
inherit (pkgs) stdenv python2 util-linux runCommand writeTextFile; inherit (pkgs) lib stdenv python2 util-linux runCommand writeTextFile;
inherit nodejs; inherit nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
}; };

View File

@ -6,7 +6,7 @@
let let
nodeEnv = import ./node-env.nix { nodeEnv = import ./node-env.nix {
inherit (pkgs) stdenv python2 utillinux runCommand writeTextFile; inherit (pkgs) lib stdenv python2 utillinux runCommand writeTextFile;
inherit nodejs; inherit nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
}; };

View File

@ -1,6 +1,6 @@
# This file originates from node2nix # This file originates from node2nix
{stdenv, nodejs, python2, utillinux, libtool, runCommand, writeTextFile}: {lib, stdenv, nodejs, python2, utillinux, libtool, runCommand, writeTextFile}:
let let
python = if nodejs ? python then nodejs.python else python2; python = if nodejs ? python then nodejs.python else python2;
@ -38,8 +38,8 @@ let
}; };
includeDependencies = {dependencies}: includeDependencies = {dependencies}:
stdenv.lib.optionalString (dependencies != []) lib.optionalString (dependencies != [])
(stdenv.lib.concatMapStrings (dependency: (lib.concatMapStrings (dependency:
'' ''
# Bundle the dependencies of the package # Bundle the dependencies of the package
mkdir -p node_modules mkdir -p node_modules
@ -100,7 +100,7 @@ let
cd "$DIR/${packageName}" cd "$DIR/${packageName}"
${includeDependencies { inherit dependencies; }} ${includeDependencies { inherit dependencies; }}
cd .. cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
''; '';
pinpointDependencies = {dependencies, production}: pinpointDependencies = {dependencies, production}:
@ -161,12 +161,12 @@ let
'' ''
node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"} node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"}
${stdenv.lib.optionalString (dependencies != []) ${lib.optionalString (dependencies != [])
'' ''
if [ -d node_modules ] if [ -d node_modules ]
then then
cd node_modules cd node_modules
${stdenv.lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies} ${lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies}
cd .. cd ..
fi fi
''} ''}
@ -183,7 +183,7 @@ let
cd "${packageName}" cd "${packageName}"
${pinpointDependencies { inherit dependencies production; }} ${pinpointDependencies { inherit dependencies production; }}
cd .. cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
fi fi
''; '';
@ -344,8 +344,8 @@ let
cd "${packageName}" cd "${packageName}"
runHook preRebuild runHook preRebuild
${stdenv.lib.optionalString bypassCache '' ${lib.optionalString bypassCache ''
${stdenv.lib.optionalString reconstructLock '' ${lib.optionalString reconstructLock ''
if [ -f package-lock.json ] if [ -f package-lock.json ]
then then
echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!" echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!"
@ -361,14 +361,14 @@ let
node ${addIntegrityFieldsScript} node ${addIntegrityFieldsScript}
''} ''}
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild
if [ "''${dontNpmInstall-}" != "1" ] if [ "''${dontNpmInstall-}" != "1" ]
then then
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used. # NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
rm -f npm-shrinkwrap.json rm -f npm-shrinkwrap.json
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install
fi fi
''; '';
@ -396,8 +396,8 @@ let
stdenv.mkDerivation ({ stdenv.mkDerivation ({
name = "node_${name}-${version}"; name = "node_${name}-${version}";
buildInputs = [ tarWrapper python nodejs ] buildInputs = [ tarWrapper python nodejs ]
++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ lib.optional (stdenv.isLinux) utillinux
++ stdenv.lib.optional (stdenv.isDarwin) libtool ++ lib.optional (stdenv.isDarwin) libtool
++ buildInputs; ++ buildInputs;
inherit nodejs; inherit nodejs;
@ -470,8 +470,8 @@ let
name = "node-dependencies-${name}-${version}"; name = "node-dependencies-${name}-${version}";
buildInputs = [ tarWrapper python nodejs ] buildInputs = [ tarWrapper python nodejs ]
++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ lib.optional (stdenv.isLinux) utillinux
++ stdenv.lib.optional (stdenv.isDarwin) libtool ++ lib.optional (stdenv.isDarwin) libtool
++ buildInputs; ++ buildInputs;
inherit dontStrip; # Stripping may fail a build for some package deployments inherit dontStrip; # Stripping may fail a build for some package deployments
@ -491,7 +491,7 @@ let
# Create fake package.json to make the npm commands work properly # Create fake package.json to make the npm commands work properly
cp ${src}/package.json . cp ${src}/package.json .
chmod 644 package.json chmod 644 package.json
${stdenv.lib.optionalString bypassCache '' ${lib.optionalString bypassCache ''
if [ -f ${src}/package-lock.json ] if [ -f ${src}/package-lock.json ]
then then
cp ${src}/package-lock.json . cp ${src}/package-lock.json .
@ -500,13 +500,13 @@ let
# Go to the parent folder to make sure that all packages are pinpointed # Go to the parent folder to make sure that all packages are pinpointed
cd .. cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
# Expose the executables that were installed # Expose the executables that were installed
cd .. cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
mv ${packageName} lib mv ${packageName} lib
ln -s $out/lib/node_modules/.bin $out/bin ln -s $out/lib/node_modules/.bin $out/bin
@ -516,7 +516,7 @@ let
stdenv.mkDerivation { stdenv.mkDerivation {
name = "node-shell-${name}-${version}"; name = "node-shell-${name}-${version}";
buildInputs = [ python nodejs ] ++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ buildInputs; buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs;
buildCommand = '' buildCommand = ''
mkdir -p $out/bin mkdir -p $out/bin
cat > $out/bin/shell <<EOF cat > $out/bin/shell <<EOF
@ -529,14 +529,14 @@ let
# Provide the dependencies in a development shell through the NODE_PATH environment variable # Provide the dependencies in a development shell through the NODE_PATH environment variable
inherit nodeDependencies; inherit nodeDependencies;
shellHook = stdenv.lib.optionalString (dependencies != []) '' shellHook = lib.optionalString (dependencies != []) ''
export NODE_PATH=${nodeDependencies}/lib/node_modules export NODE_PATH=${nodeDependencies}/lib/node_modules
export PATH="${nodeDependencies}/bin:$PATH" export PATH="${nodeDependencies}/bin:$PATH"
''; '';
}; };
in in
{ {
buildNodeSourceDist = stdenv.lib.makeOverridable buildNodeSourceDist; buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist;
buildNodePackage = stdenv.lib.makeOverridable buildNodePackage; buildNodePackage = lib.makeOverridable buildNodePackage;
buildNodeShell = stdenv.lib.makeOverridable buildNodeShell; buildNodeShell = lib.makeOverridable buildNodeShell;
} }

View File

@ -6,7 +6,7 @@
let let
nodeEnv = import ../../node-packages/node-env.nix { nodeEnv = import ../../node-packages/node-env.nix {
inherit (pkgs) stdenv python2 util-linux runCommand writeTextFile; inherit (pkgs) lib stdenv python2 util-linux runCommand writeTextFile;
inherit nodejs; inherit nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
}; };

View File

@ -6,7 +6,7 @@
let let
nodeEnv = import ./node-env.nix { nodeEnv = import ./node-env.nix {
inherit (pkgs) stdenv python2 util-linux runCommand writeTextFile; inherit (pkgs) lib stdenv python2 util-linux runCommand writeTextFile;
inherit nodejs; inherit nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
}; };

View File

@ -1,6 +1,6 @@
# This file originates from node2nix # This file originates from node2nix
{stdenv, nodejs, python2, util-linux, libtool, runCommand, writeTextFile}: {lib, stdenv, nodejs, python2, util-linux, libtool, runCommand, writeTextFile}:
let let
python = if nodejs ? python then nodejs.python else python2; python = if nodejs ? python then nodejs.python else python2;
@ -38,8 +38,8 @@ let
}; };
includeDependencies = {dependencies}: includeDependencies = {dependencies}:
stdenv.lib.optionalString (dependencies != []) lib.optionalString (dependencies != [])
(stdenv.lib.concatMapStrings (dependency: (lib.concatMapStrings (dependency:
'' ''
# Bundle the dependencies of the package # Bundle the dependencies of the package
mkdir -p node_modules mkdir -p node_modules
@ -100,7 +100,7 @@ let
cd "$DIR/${packageName}" cd "$DIR/${packageName}"
${includeDependencies { inherit dependencies; }} ${includeDependencies { inherit dependencies; }}
cd .. cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
''; '';
pinpointDependencies = {dependencies, production}: pinpointDependencies = {dependencies, production}:
@ -161,12 +161,12 @@ let
'' ''
node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"} node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"}
${stdenv.lib.optionalString (dependencies != []) ${lib.optionalString (dependencies != [])
'' ''
if [ -d node_modules ] if [ -d node_modules ]
then then
cd node_modules cd node_modules
${stdenv.lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies} ${lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies}
cd .. cd ..
fi fi
''} ''}
@ -183,7 +183,7 @@ let
cd "${packageName}" cd "${packageName}"
${pinpointDependencies { inherit dependencies production; }} ${pinpointDependencies { inherit dependencies production; }}
cd .. cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
fi fi
''; '';
@ -344,8 +344,8 @@ let
cd "${packageName}" cd "${packageName}"
runHook preRebuild runHook preRebuild
${stdenv.lib.optionalString bypassCache '' ${lib.optionalString bypassCache ''
${stdenv.lib.optionalString reconstructLock '' ${lib.optionalString reconstructLock ''
if [ -f package-lock.json ] if [ -f package-lock.json ]
then then
echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!" echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!"
@ -361,14 +361,14 @@ let
node ${addIntegrityFieldsScript} node ${addIntegrityFieldsScript}
''} ''}
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild
if [ "''${dontNpmInstall-}" != "1" ] if [ "''${dontNpmInstall-}" != "1" ]
then then
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used. # NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
rm -f npm-shrinkwrap.json rm -f npm-shrinkwrap.json
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install
fi fi
''; '';
@ -397,8 +397,8 @@ let
stdenv.mkDerivation ({ stdenv.mkDerivation ({
name = "node_${name}-${version}"; name = "node_${name}-${version}";
buildInputs = [ tarWrapper python nodejs ] buildInputs = [ tarWrapper python nodejs ]
++ stdenv.lib.optional (stdenv.isLinux) util-linux ++ lib.optional (stdenv.isLinux) util-linux
++ stdenv.lib.optional (stdenv.isDarwin) libtool ++ lib.optional (stdenv.isDarwin) libtool
++ buildInputs; ++ buildInputs;
inherit nodejs; inherit nodejs;
@ -476,8 +476,8 @@ let
name = "node-dependencies-${name}-${version}"; name = "node-dependencies-${name}-${version}";
buildInputs = [ tarWrapper python nodejs ] buildInputs = [ tarWrapper python nodejs ]
++ stdenv.lib.optional (stdenv.isLinux) util-linux ++ lib.optional (stdenv.isLinux) util-linux
++ stdenv.lib.optional (stdenv.isDarwin) libtool ++ lib.optional (stdenv.isDarwin) libtool
++ buildInputs; ++ buildInputs;
inherit dontStrip; # Stripping may fail a build for some package deployments inherit dontStrip; # Stripping may fail a build for some package deployments
@ -497,7 +497,7 @@ let
# Create fake package.json to make the npm commands work properly # Create fake package.json to make the npm commands work properly
cp ${src}/package.json . cp ${src}/package.json .
chmod 644 package.json chmod 644 package.json
${stdenv.lib.optionalString bypassCache '' ${lib.optionalString bypassCache ''
if [ -f ${src}/package-lock.json ] if [ -f ${src}/package-lock.json ]
then then
cp ${src}/package-lock.json . cp ${src}/package-lock.json .
@ -506,13 +506,13 @@ let
# Go to the parent folder to make sure that all packages are pinpointed # Go to the parent folder to make sure that all packages are pinpointed
cd .. cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
# Expose the executables that were installed # Expose the executables that were installed
cd .. cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
mv ${packageName} lib mv ${packageName} lib
ln -s $out/lib/node_modules/.bin $out/bin ln -s $out/lib/node_modules/.bin $out/bin
@ -522,7 +522,7 @@ let
stdenv.mkDerivation { stdenv.mkDerivation {
name = "node-shell-${name}-${version}"; name = "node-shell-${name}-${version}";
buildInputs = [ python nodejs ] ++ stdenv.lib.optional (stdenv.isLinux) util-linux ++ buildInputs; buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) util-linux ++ buildInputs;
buildCommand = '' buildCommand = ''
mkdir -p $out/bin mkdir -p $out/bin
cat > $out/bin/shell <<EOF cat > $out/bin/shell <<EOF
@ -535,14 +535,14 @@ let
# Provide the dependencies in a development shell through the NODE_PATH environment variable # Provide the dependencies in a development shell through the NODE_PATH environment variable
inherit nodeDependencies; inherit nodeDependencies;
shellHook = stdenv.lib.optionalString (dependencies != []) '' shellHook = lib.optionalString (dependencies != []) ''
export NODE_PATH=${nodeDependencies}/lib/node_modules export NODE_PATH=${nodeDependencies}/lib/node_modules
export PATH="${nodeDependencies}/bin:$PATH" export PATH="${nodeDependencies}/bin:$PATH"
''; '';
}; };
in in
{ {
buildNodeSourceDist = stdenv.lib.makeOverridable buildNodeSourceDist; buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist;
buildNodePackage = stdenv.lib.makeOverridable buildNodePackage; buildNodePackage = lib.makeOverridable buildNodePackage;
buildNodeShell = stdenv.lib.makeOverridable buildNodeShell; buildNodeShell = lib.makeOverridable buildNodeShell;
} }

View File

@ -6,7 +6,7 @@
let let
nodeEnv = import ./node-env.nix { nodeEnv = import ./node-env.nix {
inherit (pkgs) stdenv python2 util-linux runCommand writeTextFile; inherit (pkgs) lib stdenv python2 util-linux runCommand writeTextFile;
inherit nodejs; inherit nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
}; };

View File

@ -1,6 +1,6 @@
# This file originates from node2nix # This file originates from node2nix
{stdenv, nodejs, python2, util-linux, libtool, runCommand, writeTextFile}: {lib, stdenv, nodejs, python2, util-linux, libtool, runCommand, writeTextFile}:
let let
python = if nodejs ? python then nodejs.python else python2; python = if nodejs ? python then nodejs.python else python2;
@ -38,8 +38,8 @@ let
}; };
includeDependencies = {dependencies}: includeDependencies = {dependencies}:
stdenv.lib.optionalString (dependencies != []) lib.optionalString (dependencies != [])
(stdenv.lib.concatMapStrings (dependency: (lib.concatMapStrings (dependency:
'' ''
# Bundle the dependencies of the package # Bundle the dependencies of the package
mkdir -p node_modules mkdir -p node_modules
@ -100,7 +100,7 @@ let
cd "$DIR/${packageName}" cd "$DIR/${packageName}"
${includeDependencies { inherit dependencies; }} ${includeDependencies { inherit dependencies; }}
cd .. cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
''; '';
pinpointDependencies = {dependencies, production}: pinpointDependencies = {dependencies, production}:
@ -161,12 +161,12 @@ let
'' ''
node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"} node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"}
${stdenv.lib.optionalString (dependencies != []) ${lib.optionalString (dependencies != [])
'' ''
if [ -d node_modules ] if [ -d node_modules ]
then then
cd node_modules cd node_modules
${stdenv.lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies} ${lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies}
cd .. cd ..
fi fi
''} ''}
@ -183,7 +183,7 @@ let
cd "${packageName}" cd "${packageName}"
${pinpointDependencies { inherit dependencies production; }} ${pinpointDependencies { inherit dependencies production; }}
cd .. cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
fi fi
''; '';
@ -344,8 +344,8 @@ let
cd "${packageName}" cd "${packageName}"
runHook preRebuild runHook preRebuild
${stdenv.lib.optionalString bypassCache '' ${lib.optionalString bypassCache ''
${stdenv.lib.optionalString reconstructLock '' ${lib.optionalString reconstructLock ''
if [ -f package-lock.json ] if [ -f package-lock.json ]
then then
echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!" echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!"
@ -361,14 +361,14 @@ let
node ${addIntegrityFieldsScript} node ${addIntegrityFieldsScript}
''} ''}
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild
if [ "''${dontNpmInstall-}" != "1" ] if [ "''${dontNpmInstall-}" != "1" ]
then then
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used. # NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
rm -f npm-shrinkwrap.json rm -f npm-shrinkwrap.json
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install
fi fi
''; '';
@ -396,8 +396,8 @@ let
stdenv.mkDerivation ({ stdenv.mkDerivation ({
name = "node_${name}-${version}"; name = "node_${name}-${version}";
buildInputs = [ tarWrapper python nodejs ] buildInputs = [ tarWrapper python nodejs ]
++ stdenv.lib.optional (stdenv.isLinux) util-linux ++ lib.optional (stdenv.isLinux) util-linux
++ stdenv.lib.optional (stdenv.isDarwin) libtool ++ lib.optional (stdenv.isDarwin) libtool
++ buildInputs; ++ buildInputs;
inherit nodejs; inherit nodejs;
@ -470,8 +470,8 @@ let
name = "node-dependencies-${name}-${version}"; name = "node-dependencies-${name}-${version}";
buildInputs = [ tarWrapper python nodejs ] buildInputs = [ tarWrapper python nodejs ]
++ stdenv.lib.optional (stdenv.isLinux) util-linux ++ lib.optional (stdenv.isLinux) util-linux
++ stdenv.lib.optional (stdenv.isDarwin) libtool ++ lib.optional (stdenv.isDarwin) libtool
++ buildInputs; ++ buildInputs;
inherit dontStrip; # Stripping may fail a build for some package deployments inherit dontStrip; # Stripping may fail a build for some package deployments
@ -491,7 +491,7 @@ let
# Create fake package.json to make the npm commands work properly # Create fake package.json to make the npm commands work properly
cp ${src}/package.json . cp ${src}/package.json .
chmod 644 package.json chmod 644 package.json
${stdenv.lib.optionalString bypassCache '' ${lib.optionalString bypassCache ''
if [ -f ${src}/package-lock.json ] if [ -f ${src}/package-lock.json ]
then then
cp ${src}/package-lock.json . cp ${src}/package-lock.json .
@ -500,13 +500,13 @@ let
# Go to the parent folder to make sure that all packages are pinpointed # Go to the parent folder to make sure that all packages are pinpointed
cd .. cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
# Expose the executables that were installed # Expose the executables that were installed
cd .. cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
mv ${packageName} lib mv ${packageName} lib
ln -s $out/lib/node_modules/.bin $out/bin ln -s $out/lib/node_modules/.bin $out/bin
@ -516,7 +516,7 @@ let
stdenv.mkDerivation { stdenv.mkDerivation {
name = "node-shell-${name}-${version}"; name = "node-shell-${name}-${version}";
buildInputs = [ python nodejs ] ++ stdenv.lib.optional (stdenv.isLinux) util-linux ++ buildInputs; buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) util-linux ++ buildInputs;
buildCommand = '' buildCommand = ''
mkdir -p $out/bin mkdir -p $out/bin
cat > $out/bin/shell <<EOF cat > $out/bin/shell <<EOF
@ -529,14 +529,14 @@ let
# Provide the dependencies in a development shell through the NODE_PATH environment variable # Provide the dependencies in a development shell through the NODE_PATH environment variable
inherit nodeDependencies; inherit nodeDependencies;
shellHook = stdenv.lib.optionalString (dependencies != []) '' shellHook = lib.optionalString (dependencies != []) ''
export NODE_PATH=${nodeDependencies}/lib/node_modules export NODE_PATH=${nodeDependencies}/lib/node_modules
export PATH="${nodeDependencies}/bin:$PATH" export PATH="${nodeDependencies}/bin:$PATH"
''; '';
}; };
in in
{ {
buildNodeSourceDist = stdenv.lib.makeOverridable buildNodeSourceDist; buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist;
buildNodePackage = stdenv.lib.makeOverridable buildNodePackage; buildNodePackage = lib.makeOverridable buildNodePackage;
buildNodeShell = stdenv.lib.makeOverridable buildNodeShell; buildNodeShell = lib.makeOverridable buildNodeShell;
} }

View File

@ -6,7 +6,7 @@
let let
nodeEnv = import ../../node-packages/node-env.nix { nodeEnv = import ../../node-packages/node-env.nix {
inherit (pkgs) stdenv python2 util-linux runCommand writeTextFile; inherit (pkgs) lib stdenv python2 util-linux runCommand writeTextFile;
inherit nodejs; inherit nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
}; };

View File

@ -10,7 +10,7 @@ let
inherit (pkgs) fetchurl fetchgit; inherit (pkgs) fetchurl fetchgit;
}); });
nodeEnv = import ../../development/node-packages/node-env.nix { nodeEnv = import ../../development/node-packages/node-env.nix {
inherit (pkgs) stdenv python2 util-linux runCommand writeTextFile; inherit (pkgs) lib stdenv python2 util-linux runCommand writeTextFile;
inherit nodejs; inherit nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
}; };

View File

@ -6,7 +6,7 @@
let let
nodeEnv = import ../../../development/node-packages/node-env.nix { nodeEnv = import ../../../development/node-packages/node-env.nix {
inherit (pkgs) stdenv python2 util-linux runCommand writeTextFile; inherit (pkgs) lib stdenv python2 util-linux runCommand writeTextFile;
inherit nodejs; inherit nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
}; };

View File

@ -6,7 +6,7 @@
let let
nodeEnv = import ../../../development/node-packages/node-env.nix { nodeEnv = import ../../../development/node-packages/node-env.nix {
inherit (pkgs) stdenv python2 util-linux runCommand writeTextFile; inherit (pkgs) lib stdenv python2 util-linux runCommand writeTextFile;
inherit nodejs; inherit nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
}; };

View File

@ -6,7 +6,7 @@
let let
nodeEnv = import ../../../development/node-packages/node-env.nix { nodeEnv = import ../../../development/node-packages/node-env.nix {
inherit (pkgs) stdenv python2 util-linux runCommand writeTextFile; inherit (pkgs) lib stdenv python2 util-linux runCommand writeTextFile;
inherit nodejs; inherit nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
}; };

View File

@ -6,7 +6,7 @@
let let
nodeEnv = import ../../development/node-packages/node-env.nix { nodeEnv = import ../../development/node-packages/node-env.nix {
inherit (pkgs) stdenv python2 util-linux runCommand writeTextFile; inherit (pkgs) lib stdenv python2 util-linux runCommand writeTextFile;
inherit nodejs; inherit nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
}; };

View File

@ -6,7 +6,7 @@
let let
nodeEnv = import ../../../../development/node-packages/node-env.nix { nodeEnv = import ../../../../development/node-packages/node-env.nix {
inherit (pkgs) stdenv python2 util-linux runCommand writeTextFile; inherit (pkgs) lib stdenv python2 util-linux runCommand writeTextFile;
inherit nodejs; inherit nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
}; };

View File

@ -6,7 +6,7 @@
let let
nodeEnv = import ../../../development/node-packages/node-env.nix { nodeEnv = import ../../../development/node-packages/node-env.nix {
inherit (pkgs) stdenv python2 util-linux runCommand writeTextFile; inherit (pkgs) lib stdenv python2 util-linux runCommand writeTextFile;
inherit nodejs; inherit nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
}; };

View File

@ -6,7 +6,7 @@
let let
nodeEnv = import ../../../development/node-packages/node-env.nix { nodeEnv = import ../../../development/node-packages/node-env.nix {
inherit (pkgs) stdenv python2 util-linux runCommand writeTextFile; inherit (pkgs) lib stdenv python2 util-linux runCommand writeTextFile;
inherit nodejs; inherit nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
}; };