buildNpmPackage: push npm_config_* options into npmHooks.npmConfigHook

these options affect npm generally, and aren't specific to our
`buildNpmPackage`. pushing these options into the `npmConfigHook` (which
is used by `buildNpmPackage`, among others) makes them available to more
packages, especially to enable cross compilation.

Colin faeab3c8 8199f6b5

+5 -5
-5
pkgs/build-support/node/build-npm-package/default.nix
··· 103 103 # Stripping takes way too long with the amount of files required by a typical Node.js project. 104 104 dontStrip = args.dontStrip or true; 105 105 106 - env = { 107 - npm_config_arch = stdenv.hostPlatform.node.arch; 108 - npm_config_platform = stdenv.hostPlatform.node.platform; 109 - } // (args.env or { }); 110 - 111 106 meta = (args.meta or { }) // { 112 107 platforms = args.meta.platforms or nodejs.meta.platforms; 113 108 };
+3
pkgs/build-support/node/build-npm-package/hooks/default.nix
··· 1 1 { 2 2 lib, 3 3 srcOnly, 4 + stdenv, 4 5 makeSetupHook, 5 6 makeWrapper, 6 7 nodejs, ··· 18 19 substitutions = { 19 20 nodeSrc = srcOnly nodejs; 20 21 nodeGyp = "${nodejs}/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js"; 22 + npmArch = stdenv.targetPlatform.node.arch; 23 + npmPlatform = stdenv.targetPlatform.node.platform; 21 24 22 25 # Specify `diff`, `jq`, and `prefetch-npm-deps` by abspath to ensure that the user's build 23 26 # inputs do not cause us to find the wrong binaries.
+2
pkgs/build-support/node/build-npm-package/hooks/npm-config-hook.sh
··· 16 16 export HOME="$TMPDIR" 17 17 export npm_config_nodedir="@nodeSrc@" 18 18 export npm_config_node_gyp="@nodeGyp@" 19 + export npm_config_arch="@npmArch@" 20 + export npm_config_platform="@npmPlatform@" 19 21 20 22 if [ -z "${npmDeps-}" ]; then 21 23 echo