1{
2 lib,
3 stdenv,
4 fetchpatch2,
5 patch_npm ? true,
6 patch_tools ? true,
7 patch_npm_catch_oserror ? patch_npm,
8 patch_tools_catch_oserror ? patch_tools,
9 patch_npm_regex_handling ? patch_npm && stdenv.buildPlatform.isDarwin,
10 patch_tools_regex_handling ? patch_tools && stdenv.buildPlatform.isDarwin,
11}:
12let
13 url = "https://github.com/nodejs/gyp-next/commit/8224deef984add7e7afe846cfb82c9d3fa6da1fb.patch?full_index=1";
14 url_regex_handling = "https://github.com/nodejs/gyp-next/commit/b21ee3150eea9fc1a8811e910e5ba64f42e1fb77.patch?full_index=1";
15in
16lib.optionals patch_tools_catch_oserror ([
17 # Fixes builds with Nix sandbox on Darwin for gyp.
18 (fetchpatch2 {
19 inherit url;
20 hash = "sha256-kvCMpedjrY64BlaC1R0NVjk/vIVivYAGVgWwMEGeP6k=";
21 stripLen = 1;
22 extraPrefix = "tools/gyp/";
23 })
24])
25++ lib.optionals patch_npm_catch_oserror ([
26 (fetchpatch2 {
27 inherit url;
28 hash = "sha256-cXTwmCRHrNhuY1+3cD/EvU0CJ+1Nk4TRh6c3twvfaW8=";
29 stripLen = 1;
30 extraPrefix = "deps/npm/node_modules/node-gyp/gyp/";
31 })
32])
33++ lib.optionals patch_tools_regex_handling ([
34 # Fixes builds with Nix sandbox on Darwin for gyp.
35 (fetchpatch2 {
36 url = url_regex_handling;
37 hash = "sha256-xDZO8GgZLPvCeTrCu6RVVFV5bmbuz9UPgHiaAJE6im0=";
38 stripLen = 1;
39 extraPrefix = "tools/gyp/";
40 })
41])
42++ lib.optionals patch_npm_regex_handling ([
43 (fetchpatch2 {
44 url = url_regex_handling;
45 hash = "sha256-fW5kQh+weCK0g3wzTJLZgAuXxetb14UAf6yxW6bIgbU=";
46 stripLen = 1;
47 extraPrefix = "deps/npm/node_modules/node-gyp/gyp/";
48 })
49])
50# TODO: remove the Darwin conditionals from this file
51++ lib.optionals stdenv.buildPlatform.isDarwin ([
52 ./gyp-patches-set-fallback-value-for-CLT-darwin.patch
53])