diff --git a/pkgs/development/web/nodejs/gyp-patches-set-fallback-value-for-CLT-darwin.patch b/pkgs/development/web/nodejs/gyp-patches-set-fallback-value-for-CLT-darwin.patch index 028214bc2fbf..28abc2efb837 100644 --- a/pkgs/development/web/nodejs/gyp-patches-set-fallback-value-for-CLT-darwin.patch +++ b/pkgs/development/web/nodejs/gyp-patches-set-fallback-value-for-CLT-darwin.patch @@ -1,5 +1,6 @@ Sandboxed builds need a fallback value for the version of the Command Line Tools -being used. +being used. Not calling `CLTVersion()` avoids relying on absolute paths, +improving the reproducibility of non-sandboxed builds. diff --git a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py index 508f6ccac3e..44bcd988c4c 100644 diff --git a/pkgs/development/web/nodejs/gyp-patches-set-fallback-value-for-CLT.patch b/pkgs/development/web/nodejs/gyp-patches-set-fallback-value-for-CLT.patch deleted file mode 100644 index cf094fdacc46..000000000000 --- a/pkgs/development/web/nodejs/gyp-patches-set-fallback-value-for-CLT.patch +++ /dev/null @@ -1,25 +0,0 @@ -Sandboxed builds need a fallback value for the version of the Command Line Tools -being used. - ---- a/tools/gyp/pylib/gyp/xcode_emulation.py -+++ b/tools/gyp/pylib/gyp/xcode_emulation.py -@@ -1552,7 +1552,7 @@ def CLTVersion(): - output = GetStdout(["/usr/sbin/softwareupdate", "--history"]) - return re.search(regex, output).groupdict()["version"] - except (GypError, OSError): -- return None -+ return "11.0.0.0.1.1567737322" - - - def GetStdoutQuiet(cmdlist): ---- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py -+++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py -@@ -1552,7 +1552,7 @@ def CLTVersion(): - output = GetStdout(["/usr/sbin/softwareupdate", "--history"]) - return re.search(regex, output).groupdict()["version"] - except (GypError, OSError): -- return None -+ return "11.0.0.0.1.1567737322" - - - def GetStdoutQuiet(cmdlist): diff --git a/pkgs/development/web/nodejs/gyp-patches.nix b/pkgs/development/web/nodejs/gyp-patches.nix index d3939887e0fd..f10abad2e1ac 100644 --- a/pkgs/development/web/nodejs/gyp-patches.nix +++ b/pkgs/development/web/nodejs/gyp-patches.nix @@ -1,19 +1,13 @@ { lib, - stdenv, fetchpatch2, patch_npm ? true, patch_tools ? true, - patch_npm_catch_oserror ? patch_npm, - patch_tools_catch_oserror ? patch_tools, - patch_npm_regex_handling ? patch_npm && stdenv.buildPlatform.isDarwin, - patch_tools_regex_handling ? patch_tools && stdenv.buildPlatform.isDarwin, }: let url = "https://github.com/nodejs/gyp-next/commit/8224deef984add7e7afe846cfb82c9d3fa6da1fb.patch?full_index=1"; - url_regex_handling = "https://github.com/nodejs/gyp-next/commit/b21ee3150eea9fc1a8811e910e5ba64f42e1fb77.patch?full_index=1"; in -lib.optionals patch_tools_catch_oserror ([ +lib.optionals patch_tools ([ # Fixes builds with Nix sandbox on Darwin for gyp. (fetchpatch2 { inherit url; @@ -22,7 +16,7 @@ lib.optionals patch_tools_catch_oserror ([ extraPrefix = "tools/gyp/"; }) ]) -++ lib.optionals patch_npm_catch_oserror ([ +++ lib.optionals patch_npm ([ (fetchpatch2 { inherit url; hash = "sha256-cXTwmCRHrNhuY1+3cD/EvU0CJ+1Nk4TRh6c3twvfaW8="; @@ -30,24 +24,6 @@ lib.optionals patch_tools_catch_oserror ([ extraPrefix = "deps/npm/node_modules/node-gyp/gyp/"; }) ]) -++ lib.optionals patch_tools_regex_handling ([ - # Fixes builds with Nix sandbox on Darwin for gyp. - (fetchpatch2 { - url = url_regex_handling; - hash = "sha256-xDZO8GgZLPvCeTrCu6RVVFV5bmbuz9UPgHiaAJE6im0="; - stripLen = 1; - extraPrefix = "tools/gyp/"; - }) -]) -++ lib.optionals patch_npm_regex_handling ([ - (fetchpatch2 { - url = url_regex_handling; - hash = "sha256-fW5kQh+weCK0g3wzTJLZgAuXxetb14UAf6yxW6bIgbU="; - stripLen = 1; - extraPrefix = "deps/npm/node_modules/node-gyp/gyp/"; - }) -]) -# TODO: remove the Darwin conditionals from this file -++ lib.optionals stdenv.buildPlatform.isDarwin ([ +++ [ ./gyp-patches-set-fallback-value-for-CLT-darwin.patch -]) +] diff --git a/pkgs/development/web/nodejs/v20.nix b/pkgs/development/web/nodejs/v20.nix index 56fc4c4ac2c6..fba3ae8ef5f6 100644 --- a/pkgs/development/web/nodejs/v20.nix +++ b/pkgs/development/web/nodejs/v20.nix @@ -30,7 +30,6 @@ let }) ./gyp-patches-pre-v22-import-sys.patch - ./gyp-patches-set-fallback-value-for-CLT.patch ]; in buildNodejs { diff --git a/pkgs/development/web/nodejs/v22.nix b/pkgs/development/web/nodejs/v22.nix index 49066f95d19a..0a794f6e3e41 100644 --- a/pkgs/development/web/nodejs/v22.nix +++ b/pkgs/development/web/nodejs/v22.nix @@ -15,14 +15,7 @@ let python = python3; }; - gypPatches = - if stdenv.buildPlatform.isDarwin then - callPackage ./gyp-patches.nix { } - ++ [ - ./gyp-patches-set-fallback-value-for-CLT.patch - ] - else - [ ]; + gypPatches = if stdenv.buildPlatform.isDarwin then callPackage ./gyp-patches.nix { } else [ ]; in buildNodejs { inherit enableNpm; diff --git a/pkgs/development/web/nodejs/v24.nix b/pkgs/development/web/nodejs/v24.nix index 948343586419..b104636f8934 100644 --- a/pkgs/development/web/nodejs/v24.nix +++ b/pkgs/development/web/nodejs/v24.nix @@ -17,10 +17,7 @@ let gypPatches = if stdenv.buildPlatform.isDarwin then - callPackage ./gyp-patches.nix { patch_tools_catch_oserror = false; } - ++ [ - ./gyp-patches-set-fallback-value-for-CLT.patch - ] + callPackage ./gyp-patches.nix { patch_tools = false; } else [ ]; in