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 = "25.5.0";
29 sha256 = "7e35efaf63c8fe7737b8c62792ec547e5a95a69f1f813fcfba28566aecc9fd92";
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}