1{
2 lib,
3 stdenv,
4 buildPackages,
5 callPackage,
6 fetchpatch2,
7 openssl,
8 python3,
9 enableNpm ? true,
10}:
11
12let
13 buildNodejs = callPackage ./nodejs.nix {
14 inherit openssl;
15 python = python3;
16 };
17in
18buildNodejs {
19 inherit enableNpm;
20 version = "24.5.0";
21 sha256 = "f1ba96204724bd1c6de7758e08b3718ba0b45d87fb3bebd7e30097874ccc8130";
22 patches =
23 (
24 if (stdenv.hostPlatform.emulatorAvailable buildPackages) then
25 [
26 ./configure-emulator.patch
27 ]
28 else
29 [
30 (fetchpatch2 {
31 url = "https://raw.githubusercontent.com/buildroot/buildroot/2f0c31bffdb59fb224387e35134a6d5e09a81d57/package/nodejs/nodejs-src/0003-include-obj-name-in-shared-intermediate.patch";
32 hash = "sha256-3g4aS+NmmUYNOYRNc6UMJKYoaTlpP5Knt9UHegx+o0Y=";
33 })
34 ]
35 )
36 ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isFreeBSD) [
37 # This patch is concerning.
38 # https://github.com/nodejs/node/issues/54576
39 # It is only supposed to affect clang >= 17, but I'm seeing it on clang 19.
40 # I'm keeping the predicate for this patch pretty strict out of caution,
41 # so if you see the error it's supposed to prevent, feel free to loosen it.
42 (fetchpatch2 {
43 url = "https://raw.githubusercontent.com/rubyjs/libv8-node/62476a398d4c9c1a670240a3b070d69544be3761/patch/v8-no-assert-trivially-copyable.patch";
44 hash = "sha256-hSTLljmVzYmc3WAVeRq9EPYluXGXFeWVXkykufGQPVw=";
45 })
46 ]
47 ++ [
48 ./configure-armv6-vfpv2.patch
49 ./disable-darwin-v8-system-instrumentation-node19.patch
50 ./bypass-darwin-xcrun-node16.patch
51 ./node-npm-build-npm-package-logic.patch
52 ./use-correct-env-in-tests.patch
53 ./bin-sh-node-run-v22.patch
54 ]
55 ++ lib.optionals (!stdenv.buildPlatform.isDarwin) [
56 # test-icu-env is failing without the reverts
57 (fetchpatch2 {
58 url = "https://github.com/nodejs/node/commit/869d0cbca3b0b5e594b3254869a34d549664e089.patch?full_index=1";
59 hash = "sha256-BBBShQwU20TSY8GtPehQ9i3AH4ZKUGIr8O0bRsgrpNo=";
60 revert = true;
61 })
62 ];
63}