From 366191a9d10d599b984a38e5a3825617a9ea40fc Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 8 Feb 2026 00:27:42 +0200 Subject: [PATCH] yarnConfigHook: prevent yarn from resolving dependencies using git Fixes #483500. Tested with the following: ```diff diff --git i/pkgs/by-name/gr/graphest/package.nix w/pkgs/by-name/gr/graphest/package.nix index 2c6093b385d2..d8f54103a8fc 100644 --- i/pkgs/by-name/gr/graphest/package.nix +++ w/pkgs/by-name/gr/graphest/package.nix @@ -23,14 +23,13 @@ stdenv.mkDerivation (finalAttrs: { pname = "graphest"; - # 1.8.2 cannot build due to https://github.com/NixOS/nixpkgs/issues/483500 - version = "1.8.2-unstable-2026-01-21"; + version = "1.8.2"; src = fetchFromGitHub { owner = "unageek"; repo = "graphest"; - rev = "2bcb478acd40a1174606e51f4affeca56446c9f6"; - hash = "sha256-+onb21xb8nhEKIL/B8sNufWaPVhABnpU3uIyRn4ISWQ="; + tag = "v${finalAttrs.version}"; + hash = "sha256-cFcakTi2SRogz3pge4gxhfowjNwhS1G3QT32N7MFIdw="; }; patches = [ @@ -65,7 +64,7 @@ stdenv.mkDerivation (finalAttrs: { yarnOfflineCache = fetchYarnDeps { yarnLock = finalAttrs.src + "/yarn.lock"; - hash = "sha256-krpJflsoUPIzhdtyQu3WmapM4C63adwOq2Q6inUa3Xk="; + hash = "sha256-3lh1yx2wJyYKkSGx1zMzHBdAZzMj+k0VcKBa4Mf8DAU="; }; env.ELECTRON_SKIP_BINARY_DOWNLOAD = 1; ``` --- pkgs/build-support/node/fetch-yarn-deps/fixup.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/node/fetch-yarn-deps/fixup.js b/pkgs/build-support/node/fetch-yarn-deps/fixup.js index b9c8c90b6169..c8dc8a27f139 100755 --- a/pkgs/build-support/node/fetch-yarn-deps/fixup.js +++ b/pkgs/build-support/node/fetch-yarn-deps/fixup.js @@ -33,7 +33,9 @@ const fixupYarnLock = async (lockContents, verbose) => { if (hash) pkg.resolved += `#${hash}` - return [dep, pkg] + // Rewrite key to remove git+ prefix and .git suffix to prevent yarn git resolver + let fixedDep = dep.replace(/@git\+/, '@').replace(/\.git(#|$)/, '$1') + return [fixedDep, pkg] }) )