diff --git a/pkgs/development/web/nodejs/v22.nix b/pkgs/development/web/nodejs/v22.nix index 462766a97d272..f850d04d575d5 100644 --- a/pkgs/development/web/nodejs/v22.nix +++ b/pkgs/development/web/nodejs/v22.nix @@ -58,5 +58,15 @@ buildNodejs { hash = "sha256-k3h8mPgvaIYGAkGmaL+ix7kUnyLw4/PF7wXMAWrPMXo="; revert = true; }) + # Fixes builds with Nix sandbox on Darwin for gyp. + # See https://github.com/NixOS/nixpkgs/issues/261820 + # and https://github.com/nodejs/gyp-next/pull/216 + (fetchpatch2 { + name = "gyp-darwin-sandbox.patch"; + url = "https://github.com/nodejs/gyp-next/commit/706d04aba5bd18f311dc56f84720e99f64c73466.patch?full_index=1"; + hash = "sha256-1iyeeAprmWpmLafvOOXW45iZ4jWFSloWJxQ0reAKBOo="; + stripLen = 1; + extraPrefix = "deps/npm/node_modules/node-gyp/gyp/"; + }) ]; }