{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 # Stripping takes way too long with the amount of files required by a typical Node.js project. 105 dontStrip = args.dontStrip or true; 106 107 meta = (args.meta or { }) // { 108 platforms = args.meta.platforms or nodejs.meta.platforms; 109 };
··· 104 # Stripping takes way too long with the amount of files required by a typical Node.js project. 105 dontStrip = args.dontStrip or true; 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 + 117 meta = (args.meta or { }) // { 118 platforms = args.meta.platforms or nodejs.meta.platforms; 119 };
+2
pkgs/by-name/no/node-gyp/package.nix
··· 1 { 2 buildNpmPackage, 3 fetchFromGitHub, 4 lib, ··· 20 21 postPatch = '' 22 ln -s ${./package-lock.json} package-lock.json 23 ''; 24 25 dontNpmBuild = true;
··· 1 { 2 + stdenv, 3 buildNpmPackage, 4 fetchFromGitHub, 5 lib, ··· 21 22 postPatch = '' 23 ln -s ${./package-lock.json} package-lock.json 24 + substituteInPlace gyp/pylib/gyp/**.py --replace-fail sys.platform '"${stdenv.targetPlatform.parsed.kernel.name}"' 25 ''; 26 27 dontNpmBuild = true;