nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 };
17
18 gypPatches =
19 if stdenv.buildPlatform.isDarwin then
20 [
21 ./gyp-patches-set-fallback-value-for-CLT-darwin.patch
22 ]
23 else
24 [ ];
25in
26buildNodejs {
27 inherit enableNpm;
28 version = "24.13.0";
29 sha256 = "320fe909cbb347dcf516201e4964ef177b8138df9a7f810d0d54950481b3158b";
30 patches =
31 (
32 if (stdenv.hostPlatform.emulatorAvailable buildPackages) then
33 [
34 ./configure-emulator.patch
35 ]
36 else
37 [
38 (fetchpatch2 {
39 url = "https://raw.githubusercontent.com/buildroot/buildroot/2f0c31bffdb59fb224387e35134a6d5e09a81d57/package/nodejs/nodejs-src/0003-include-obj-name-in-shared-intermediate.patch";
40 hash = "sha256-3g4aS+NmmUYNOYRNc6UMJKYoaTlpP5Knt9UHegx+o0Y=";
41 })
42 ]
43 )
44 ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isFreeBSD) [
45 # This patch is concerning.
46 # https://github.com/nodejs/node/issues/54576
47 # It is only supposed to affect clang >= 17, but I'm seeing it on clang 19.
48 # I'm keeping the predicate for this patch pretty strict out of caution,
49 # so if you see the error it's supposed to prevent, feel free to loosen it.
50 (fetchpatch2 {
51 url = "https://raw.githubusercontent.com/rubyjs/libv8-node/62476a398d4c9c1a670240a3b070d69544be3761/patch/v8-no-assert-trivially-copyable.patch";
52 hash = "sha256-hSTLljmVzYmc3WAVeRq9EPYluXGXFeWVXkykufGQPVw=";
53 })
54 ]
55 ++ [
56 ./configure-armv6-vfpv2.patch
57 ./node-npm-build-npm-package-logic.patch
58 ./use-correct-env-in-tests.patch
59 ./bin-sh-node-run-v22.patch
60 ./use-nix-codesign.patch
61 ]
62 ++ gypPatches
63 ++ lib.optionals (!stdenv.buildPlatform.isDarwin) [
64 # test-icu-env is failing without the reverts
65 (fetchpatch2 {
66 url = "https://github.com/nodejs/node/commit/869d0cbca3b0b5e594b3254869a34d549664e089.patch?full_index=1";
67 hash = "sha256-BBBShQwU20TSY8GtPehQ9i3AH4ZKUGIr8O0bRsgrpNo=";
68 revert = true;
69 })
70 ]
71 ++ lib.optionals stdenv.is32bit [
72 # see: https://github.com/nodejs/node/issues/58458
73 ./v24-32bit.patch
74 # see: https://github.com/nodejs/node/issues/61025
75 ./sab-test-32bit.patch
76 ];
77}