2024-07-27 06:49:29 +00:00
|
|
|
{ callPackage, lib, overrideCC, pkgs, buildPackages, openssl, python311, fetchpatch2, enableNpm ? true }:
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
|
|
let
|
2023-11-16 04:20:00 +00:00
|
|
|
# Clang 16+ cannot build Node v18 due to -Wenum-constexpr-conversion errors.
|
|
|
|
# Use an older version of clang with the current libc++ for compatibility (e.g., with icu).
|
|
|
|
ensureCompatibleCC = packages:
|
|
|
|
if packages.stdenv.cc.isClang && lib.versionAtLeast (lib.getVersion packages.stdenv.cc.cc) "16"
|
|
|
|
then overrideCC packages.llvmPackages_15.stdenv (packages.llvmPackages_15.stdenv.cc.override {
|
|
|
|
inherit (packages.llvmPackages) libcxx;
|
|
|
|
})
|
|
|
|
else packages.stdenv;
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
buildNodejs = callPackage ./nodejs.nix {
|
2022-09-30 11:47:45 +00:00
|
|
|
inherit openssl;
|
2023-11-16 04:20:00 +00:00
|
|
|
stdenv = ensureCompatibleCC pkgs;
|
|
|
|
buildPackages = buildPackages // { stdenv = ensureCompatibleCC buildPackages; };
|
2024-07-27 06:49:29 +00:00
|
|
|
python = python311;
|
2022-04-27 09:35:20 +00:00
|
|
|
};
|
2024-07-31 10:19:44 +00:00
|
|
|
|
|
|
|
gypPatches = callPackage ./gyp-patches.nix { } ++ [
|
|
|
|
./gyp-patches-pre-v22-import-sys.patch
|
|
|
|
];
|
2022-04-27 09:35:20 +00:00
|
|
|
in
|
|
|
|
buildNodejs {
|
|
|
|
inherit enableNpm;
|
2024-07-31 10:19:44 +00:00
|
|
|
version = "18.20.4";
|
|
|
|
sha256 = "sha256-p2x+oblq62ljoViAYmDICUtiRNZKaWUp0CBUe5qVyio=";
|
2022-04-27 09:35:20 +00:00
|
|
|
patches = [
|
2024-09-19 14:19:46 +00:00
|
|
|
./configure-emulator-node18.patch
|
|
|
|
./configure-armv6-vfpv2.patch
|
2022-09-09 14:08:57 +00:00
|
|
|
./disable-darwin-v8-system-instrumentation.patch
|
2022-10-30 15:09:59 +00:00
|
|
|
./bypass-darwin-xcrun-node16.patch
|
2023-03-27 19:17:25 +00:00
|
|
|
./revert-arm64-pointer-auth.patch
|
2023-05-24 13:37:59 +00:00
|
|
|
./node-npm-build-npm-package-logic.patch
|
2023-10-09 19:29:22 +00:00
|
|
|
./trap-handler-backport.patch
|
2024-07-27 06:49:29 +00:00
|
|
|
./use-correct-env-in-tests.patch
|
|
|
|
./v18-openssl-3.0.14.patch
|
|
|
|
(fetchpatch2 {
|
|
|
|
url = "https://github.com/nodejs/node/commit/534c122de166cb6464b489f3e6a9a544ceb1c913.patch";
|
|
|
|
hash = "sha256-4q4LFsq4yU1xRwNsM1sJoNVphJCnxaVe2IyL6AeHJ/I=";
|
|
|
|
})
|
2024-09-19 14:19:46 +00:00
|
|
|
(fetchpatch2 {
|
|
|
|
url = "https://github.com/nodejs/node/commit/87598d4b63ef2c827a2bebdfa0f1540c35718519.patch";
|
|
|
|
hash = "sha256-JJi8z9aaWnu/y3nZGOSUfeNzNSCYzD9dzoHXaGkeaEA=";
|
|
|
|
includes = ["test/common/assertSnapshot.js"];
|
|
|
|
})
|
|
|
|
(fetchpatch2 {
|
|
|
|
url = "https://github.com/nodejs/node/commit/d0a6b605fba6cd69a82e6f12ff0363eef8fe1ee9.patch";
|
|
|
|
hash = "sha256-TfYal/PikRZHL6zpAlC3SmkYXCe+/8Gs83dLX/X/P/k=";
|
|
|
|
})
|
2024-07-31 10:19:44 +00:00
|
|
|
] ++ gypPatches;
|
2022-04-27 09:35:20 +00:00
|
|
|
}
|