buildNpmPackage: fix cross builds

This commit is contained in:
Audrey Dutcher
2025-03-18 14:08:21 -07:00
parent d93bc55f85
commit c522c987ca
2 changed files with 11 additions and 1 deletions
@@ -104,6 +104,16 @@ lib.extendMkDerivation {
# Stripping takes way too long with the amount of files required by a typical Node.js project.
dontStrip = args.dontStrip or true;
env = {
npm_config_arch =
{
"x86_64" = "x64";
"aarch64" = "arm64";
}
.${stdenv.hostPlatform.parsed.cpu.name} or stdenv.hostPlatform.parsed.cpu.name;
npm_config_platform = stdenv.hostPlatform.parsed.kernel.name;
} // (args.env or { });
meta = (args.meta or { }) // {
platforms = args.meta.platforms or nodejs.meta.platforms;
};
+1 -1
View File
@@ -21,7 +21,7 @@
postPatch = ''
ln -s ${./package-lock.json} package-lock.json
sed -E -i -e 's/sys.platform/"${stdenv.targetPlatform.parsed.kernel.name}"/g' gyp/pylib/gyp/**.py
substituteInPlace gyp/pylib/gyp/**.py --replace-fail sys.platform '"${stdenv.targetPlatform.parsed.kernel.name}"'
'';
dontNpmBuild = true;