fetchPnpmDeps: fix reproducibility of pnpm v11 store index

The pnpm v11 store uses a SQLite database (index.db) whose binary format
is non-deterministic across platforms (version-valid-for number, etc).
This caused hash mismatches when building the same pnpmDeps on different
machines despite identical logical content.

Fix by dumping the SQLite database to a text SQL file during the fetch
phase and reconstructing it during the build phase. This ensures the
stored representation is fully deterministic.

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Co-authored-by: Gergő Gutyina <gutyina.gergo.2@gmail.com>
This commit is contained in:
Maciej Krüger
2026-05-19 20:24:30 +02:00
committed by Sefa Eyeoglu
parent f63696258a
commit f2ba699f37
3 changed files with 23 additions and 3 deletions

View File

@@ -342,7 +342,7 @@ stdenv.mkDerivation (finalAttrs: {
pnpmDeps = fetchPnpmDeps {
inherit (finalAttrs) pname version src;
inherit pnpm;
fetcherVersion = 3;
fetcherVersion = 4;
hash = "...";
};
})
@@ -384,7 +384,7 @@ It is highly recommended to use a pinned version of pnpm (i.e., `pnpm_9` or `pnp
pnpmDeps = fetchPnpmDeps {
inherit (finalAttrs) pname version src;
+ pnpm = pnpm_10;
fetcherVersion = 3;
fetcherVersion = 4;
hash = "...";
};
})
@@ -498,7 +498,7 @@ This is the version of the output of `fetchPnpmDeps`. New packages should use `3
# ...
pnpmDeps = fetchPnpmDeps {
# ...
fetcherVersion = 3;
fetcherVersion = 4;
hash = "..."; # clear this hash and generate a new one
};
}
@@ -516,6 +516,7 @@ Version 3 is the recommended value for new packages. Versions 1 and 2 are deprec
- 1: Initial version, nothing special.
- 2: [Ensure consistent permissions](https://github.com/NixOS/nixpkgs/pull/422975)
- 3: [Build a reproducible tarball](https://github.com/NixOS/nixpkgs/pull/469950)
- 4: [Dump SQLite database to an SQL file](https://github.com/NixOS/nixpkgs/pull/522703)
### Yarn {#javascript-yarn}