treewide: replace node platform mapping with stdenv.hostPlatform.node.{arch,platform}

This commit is contained in:
Colin
2025-07-07 03:08:06 +00:00
parent b3daf8c3a5
commit 8199f6b551
4 changed files with 7 additions and 33 deletions
@@ -104,13 +104,8 @@ lib.extendMkDerivation {
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;
npm_config_arch = stdenv.hostPlatform.node.arch;
npm_config_platform = stdenv.hostPlatform.node.platform;
} // (args.env or { });
meta = (args.meta or { }) // {
+2 -8
View File
@@ -13,14 +13,8 @@
}:
let
hostPlatform = stdenvNoCC.hostPlatform;
nodePlatform = hostPlatform.parsed.kernel.name; # nodejs's `process.platform`
nodeArch = # nodejs's `process.arch`
{
"x86_64" = "x64";
"aarch64" = "arm64";
}
.${hostPlatform.parsed.cpu.name}
or (throw "affine-bin(${buildType}): unsupported CPU family ${hostPlatform.parsed.cpu.name}");
nodePlatform = hostPlatform.node.platform;
nodeArch = hostPlatform.node.arch;
in
stdenvNoCC.mkDerivation (
finalAttrs:
+2 -8
View File
@@ -26,14 +26,8 @@
}:
let
hostPlatform = stdenvNoCC.hostPlatform;
nodePlatform = hostPlatform.parsed.kernel.name; # nodejs's `process.platform`
nodeArch = # nodejs's `process.arch`
{
"x86_64" = "x64";
"aarch64" = "arm64";
}
.${hostPlatform.parsed.cpu.name}
or (throw "affine(${buildType}): unsupported CPU family ${hostPlatform.parsed.cpu.name}");
nodePlatform = hostPlatform.node.platform;
nodeArch = hostPlatform.node.arch;
electron = electron_35;
nodejs = nodejs_22;
yarn-berry = yarn-berry_4.override { inherit nodejs; };
@@ -52,16 +52,7 @@ stdenv.mkDerivation rec {
# Make sure the native modules are built against electron's ABI
"--nodedir=${electron.headers}"
# https://nodejs.org/api/os.html#osarch
"--arch=${
if stdenv.hostPlatform.parsed.cpu.name == "i686" then
"ia32"
else if stdenv.hostPlatform.parsed.cpu.name == "x86_64" then
"x64"
else if stdenv.hostPlatform.parsed.cpu.name == "aarch64" then
"arm64"
else
stdenv.hostPlatform.parsed.cpu.name
}"
"--arch=${stdenv.hostPlatform.node.arch}"
];
installPhase = ''