diff options
author | Jörg Thalheim <Mic92@users.noreply.github.com> | 2021-01-30 08:40:47 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-30 08:40:47 +0000 |
commit | fd2dcf3b17d7624ad646b5353232148fffc183a4 (patch) | |
tree | 12e2ccfa37651c193ed113d357ca352abe7fc15d /pkgs/development/node-packages | |
parent | 1c12fe62b6100b6c7846e4046e60ec50598e23e9 (diff) | |
parent | 32fc8b9134c5fd56851ba1845f04d17484ea7170 (diff) |
Merge pull request #111247 from siraben/stdenv-lib-node-env
pkgs/development: stdenv.lib -> lib in node-composition files
Diffstat (limited to 'pkgs/development/node-packages')
-rw-r--r-- | pkgs/development/node-packages/composition.nix | 2 | ||||
-rw-r--r-- | pkgs/development/node-packages/node-env.nix | 46 |
2 files changed, 24 insertions, 24 deletions
diff --git a/pkgs/development/node-packages/composition.nix b/pkgs/development/node-packages/composition.nix index 027a981ea57f..0769168a78fa 100644 --- a/pkgs/development/node-packages/composition.nix +++ b/pkgs/development/node-packages/composition.nix @@ -6,7 +6,7 @@ let nodeEnv = import ./node-env.nix { - inherit (pkgs) stdenv python2 util-linux runCommand writeTextFile; + inherit (pkgs) lib stdenv python2 util-linux runCommand writeTextFile; inherit nodejs; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; }; diff --git a/pkgs/development/node-packages/node-env.nix b/pkgs/development/node-packages/node-env.nix index f65cb65cf8da..9af216ad1dfe 100644 --- a/pkgs/development/node-packages/node-env.nix +++ b/pkgs/development/node-packages/node-env.nix @@ -1,6 +1,6 @@ # This file originates from node2nix -{stdenv, nodejs, python2, util-linux, libtool, runCommand, writeTextFile}: +{lib, stdenv, nodejs, python2, util-linux, libtool, runCommand, writeTextFile}: let python = if nodejs ? python then nodejs.python else python2; @@ -38,8 +38,8 @@ let }; includeDependencies = {dependencies}: - stdenv.lib.optionalString (dependencies != []) - (stdenv.lib.concatMapStrings (dependency: + lib.optionalString (dependencies != []) + (lib.concatMapStrings (dependency: '' # Bundle the dependencies of the package mkdir -p node_modules @@ -100,7 +100,7 @@ let cd "$DIR/${packageName}" ${includeDependencies { inherit dependencies; }} cd .. - ${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} + ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ''; pinpointDependencies = {dependencies, production}: @@ -161,12 +161,12 @@ let '' node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"} - ${stdenv.lib.optionalString (dependencies != []) + ${lib.optionalString (dependencies != []) '' if [ -d node_modules ] then cd node_modules - ${stdenv.lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies} + ${lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies} cd .. fi ''} @@ -183,7 +183,7 @@ let cd "${packageName}" ${pinpointDependencies { inherit dependencies production; }} cd .. - ${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} + ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} fi ''; @@ -344,8 +344,8 @@ let cd "${packageName}" runHook preRebuild - ${stdenv.lib.optionalString bypassCache '' - ${stdenv.lib.optionalString reconstructLock '' + ${lib.optionalString bypassCache '' + ${lib.optionalString reconstructLock '' if [ -f package-lock.json ] then echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!" @@ -361,14 +361,14 @@ let 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" ] then # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. 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 ''; @@ -397,8 +397,8 @@ let stdenv.mkDerivation ({ name = "node_${name}-${version}"; buildInputs = [ tarWrapper python nodejs ] - ++ stdenv.lib.optional (stdenv.isLinux) util-linux - ++ stdenv.lib.optional (stdenv.isDarwin) libtool + ++ lib.optional (stdenv.isLinux) util-linux + ++ lib.optional (stdenv.isDarwin) libtool ++ buildInputs; inherit nodejs; @@ -476,8 +476,8 @@ let name = "node-dependencies-${name}-${version}"; buildInputs = [ tarWrapper python nodejs ] - ++ stdenv.lib.optional (stdenv.isLinux) util-linux - ++ stdenv.lib.optional (stdenv.isDarwin) libtool + ++ lib.optional (stdenv.isLinux) util-linux + ++ lib.optional (stdenv.isDarwin) libtool ++ buildInputs; 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 cp ${src}/package.json . chmod 644 package.json - ${stdenv.lib.optionalString bypassCache '' + ${lib.optionalString bypassCache '' if [ -f ${src}/package-lock.json ] then cp ${src}/package-lock.json . @@ -506,13 +506,13 @@ let # Go to the parent folder to make sure that all packages are pinpointed 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; }} # Expose the executables that were installed cd .. - ${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} + ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} mv ${packageName} lib ln -s $out/lib/node_modules/.bin $out/bin @@ -522,7 +522,7 @@ let stdenv.mkDerivation { 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 = '' mkdir -p $out/bin cat > $out/bin/shell <<EOF @@ -535,14 +535,14 @@ let # Provide the dependencies in a development shell through the NODE_PATH environment variable inherit nodeDependencies; - shellHook = stdenv.lib.optionalString (dependencies != []) '' + shellHook = lib.optionalString (dependencies != []) '' export NODE_PATH=${nodeDependencies}/lib/node_modules export PATH="${nodeDependencies}/bin:$PATH" ''; }; in { - buildNodeSourceDist = stdenv.lib.makeOverridable buildNodeSourceDist; - buildNodePackage = stdenv.lib.makeOverridable buildNodePackage; - buildNodeShell = stdenv.lib.makeOverridable buildNodeShell; + buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist; + buildNodePackage = lib.makeOverridable buildNodePackage; + buildNodeShell = lib.makeOverridable buildNodeShell; } |