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 = "22.14.0";
21 sha256 = "c609946bf793b55c7954c26582760808d54c16185d79cb2fb88065e52de21914";
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 # fix test failure on macos 15.4
55 (fetchpatch2 {
56 url = "https://github.com/nodejs/node/commit/33f6e1ea296cd20366ab94e666b03899a081af94.patch?full_index=1";
57 hash = "sha256-aVBMcQlhQeviUQpMIfC988jjDB2BgYzlMYsq+w16mzU=";
58 })
59 ];
60}