{buildNpmPackage,node-gyp}: fix cross builds (#387729)

authored by Audrey Dutcher and committed by GitHub 157cb194 47fbdfd4

+12
+10
pkgs/build-support/node/build-npm-package/default.nix
··· 104 104 # Stripping takes way too long with the amount of files required by a typical Node.js project. 105 105 dontStrip = args.dontStrip or true; 106 106 107 + env = { 108 + npm_config_arch = 109 + { 110 + "x86_64" = "x64"; 111 + "aarch64" = "arm64"; 112 + } 113 + .${stdenv.hostPlatform.parsed.cpu.name} or stdenv.hostPlatform.parsed.cpu.name; 114 + npm_config_platform = stdenv.hostPlatform.parsed.kernel.name; 115 + } // (args.env or { }); 116 + 107 117 meta = (args.meta or { }) // { 108 118 platforms = args.meta.platforms or nodejs.meta.platforms; 109 119 };
+2
pkgs/by-name/no/node-gyp/package.nix
··· 1 1 { 2 + stdenv, 2 3 buildNpmPackage, 3 4 fetchFromGitHub, 4 5 lib, ··· 20 21 21 22 postPatch = '' 22 23 ln -s ${./package-lock.json} package-lock.json 24 + substituteInPlace gyp/pylib/gyp/**.py --replace-fail sys.platform '"${stdenv.targetPlatform.parsed.kernel.name}"' 23 25 ''; 24 26 25 27 dontNpmBuild = true;