Commit Graph

309 Commits

Author SHA1 Message Date
adisbladis
ba6101c8a5 importNpmLock: correctly handle more dist tags than just "latest" (#548376) 2026-08-07 18:38:38 +00:00
Marie Ramlow
553fb879c3 fetchNpmDeps: assert fetcherVersion is not higher than latest version
If we introduce version 3, current packages that use the non-existent
version 3 will get their hashes broken. Prevent stupid LLMs from
introducing more trouble when hallucinating more non-existent versions.
2026-08-02 12:38:47 +02:00
adisbladis
5666445319 importNpmLock: correctly handle more dist tags than just "latest"
Discovered while trying to package https://github.com/membermatters/membermatters (out of tree)
where its dependency on @intlify/message-compiler failed.
2026-08-02 11:37:12 +02:00
Florian Klink
b3ee76e2a1 fetchYarnDeps: set impureEnvVars
Similar fix as https://github.com/NixOS/nixpkgs/pull/379841, but for
FODs using fetchYarnDeps.
2026-07-29 18:18:25 +02:00
Gutyina Gergő
de25c842e5 fetchPnpmDeps: drop fetcherVersion = 3 for pnpm_11 and the related test 2026-07-07 14:35:19 +02:00
Gutyina Gergő
29ee10df31 fetchPnpmDeps: fix changed hashes due to sqlite bump by reverting to old format 2026-07-07 13:37:57 +02:00
nixpkgs-ci[bot]
bdc85a592e Merge master into staging-next 2026-06-27 07:06:21 +00:00
Sefa Eyeoglu
0271261382 fetchPnpmDeps: remove redundant guard for pnpm-fixup-state-db override (#531027) 2026-06-27 01:45:27 +00:00
K900
d4c077ace1 Merge remote-tracking branch 'origin/staging-next' into staging 2026-06-26 21:41:51 +03:00
Marcin Serwin
ff677dc840 fetchPnpmDeps: drop serve (#525377) 2026-06-26 17:29:01 +00:00
nixpkgs-ci[bot]
0f0b57829b Merge staging-next into staging 2026-06-22 17:40:41 +00:00
K900
8f26ec5602 pnpmConfigHook: allow opt-out
This is sometimes useful when mixing ecosystems, e.g. in buildGoModule.
2026-06-22 18:44:29 +03:00
Doron Behar
903158447f prefetch-npm-deps: support file: scheme for dependencies (#484423) 2026-06-17 07:59:14 +00:00
Gutyina Gergő
279b129035 fetchPnpmDeps: remove redundant guard for pnpm-fixup-state-db override 2026-06-12 14:53:01 +02:00
Antoine du Hamel
49a4bd0573 pnpm-fixup-state-db: make it depend on nodejs-slim (#528786) 2026-06-12 12:41:42 +00:00
Gergő Gutyina
d6913b3b7c pnpmConfigHook: add support for __structuredAttrs = true (#528517) 2026-06-10 21:53:32 +00:00
Antoine du Hamel
3f318e99f1 pnpm-fixup-state-db: make it depend on nodejs-slim 2026-06-07 16:25:38 +02:00
Gergő Gutyina
3604c8c851 pnpm: switch to nodejs-slim (#514575) 2026-06-06 10:46:45 +00:00
Antoine du Hamel
36b6c90e6b pnpm: switch to nodejs-slim 2026-06-06 00:36:37 +02:00
André Lima
4fb02c0c8f pnpmConfigHook: add support for __structuredAttrs = true 2026-06-05 21:08:28 +01:00
Gutyina Gergő
5c3225070d fetchPnpmDeps: drop serve 2026-06-04 13:38:43 +02:00
Gergő Gutyina
49ffcc65f9 fetchPnpmDeps: remove fetcherVersion = 1 and 2 (#523933) 2026-06-03 09:03:19 +00:00
Aliaksandr
3962275b5d fetchPnpmDeps,pnpmConfigHook: remove dead fetcherVersion < 3 infrastructure
With fetcherVersion = 1 and 2 removed, the minimum supported version is 3,
so every store is a reproducible tarball with consistent permissions. Drop
the now-unreachable `fetcherVersion < 3` branches:

- always bundle the store into pnpm-store.tar.zst (drop the direct-to-$out path)
- always write $out/.fetcher-version (drop the `> 1` guard)
- always normalise permissions (drop the `>= 2` guard)
- always extract the tarball in pnpmConfigHook and serve.nix (drop the cp
  fallback and the `|| echo 1` default)

The `>= 4` SQLite-dump guard is kept, since v3 and v4 still differ. Output
for existing v3/v4 derivations is byte-identical, so no hashes change.

Assisted-by: claude-code with claude-opus-4-7[1m]-xhigh
2026-05-31 23:50:22 +03:00
Aliaksandr
2c01146d7d fetchPnpmDeps: throw on removed fetcherVersion = 1 and 2
fetcherVersion = 1 and 2 were deprecated in the 26.05 release and
scheduled for removal in 26.11. Remove them from supportedFetcherVersions
and replace the deprecation warning with a hard throw that points users
at the migration to fetcherVersion = 3.

No in-tree package still uses fetcherVersion = 1 or 2. The now-unreachable
v1/v2 code paths are removed in a follow-up commit.

Assisted-by: claude-code with claude-opus-4-7[1m]-xhigh
2026-05-31 23:50:21 +03:00
TANIGUCHI Kohei
ea5ff3b2bc fetchPnpmDeps,pnpmConfigHook: drop pnpmWorkspace migration guards
The deprecated singular `pnpmWorkspace` attribute (superseded by
`pnpmWorkspaces` in #350751) has no remaining in-tree users, so the
assert and hook check pointing users to the new attribute are no
longer needed.

Assisted-by: Claude Code (Claude Opus 4.7)
2026-05-30 06:33:07 +09:00
Philip Taron
0c469218f3 build-support: remove assertMsg, throwIf, and throwIfNot usage (#524535) 2026-05-28 18:09:32 +00:00
Antoine du Hamel
617b299a40 fetch-yarn-deps: remove unused nodejs argument 2026-05-28 11:36:13 +02:00
Antoine du Hamel
8bd4119182 buildNpmPackage: remove double dependencies on nodejs+nodejs-slim 2026-05-28 11:36:13 +02:00
Gergő Gutyina
173e1366fc pnpm: 11.1.2 -> 11.3.0 (#522531) 2026-05-27 12:35:50 +00:00
Eman Resu
de262e96ec build-support/node: remove throwIf usage 2026-05-26 14:50:35 -04:00
Sigmanificient
0bbc8dffae treewide: set meta.license on hooks 2026-05-25 13:48:20 +02:00
Sefa Eyeoglu
d5cbb9e641 fetchPnpmDeps,pnpmConfigHook: print final config before install
This should help debugging config values. I verified that `pnpm config
list` works across pnpm_8, pnpm_9, pnpm_10, pnpm_10_29_2 and pnpm_11.

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2026-05-24 13:58:32 +02:00
Sefa Eyeoglu
599909067c pnpmConfigHook: disable lockfile verification against supply-chain policies
These checks are still performed in fetchPnpmDeps. These checks require
access to the registries used in the lockfile, making it infeasible to
run during configurePhase in a sandboxed build.

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2026-05-24 13:58:32 +02:00
Sefa Eyeoglu
f9679155c9 fetchPnpmDeps: fix reproducibility of pnpm v11 store index (#522703) 2026-05-24 09:38:04 +00:00
Maciej Krüger
f2ba699f37 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>
2026-05-23 22:13:33 +02:00
Sefa Eyeoglu
d00feeb02a pnpmConfigHook: add instructions for ERR_PNPM_LOCKFILE_CONFIG_MISMATCH
See https://github.com/NixOS/nixpkgs/pull/505103#issuecomment-4496933583

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2026-05-21 10:00:11 +02:00
nixpkgs-ci[bot]
700251b5b8 Merge master into staging-next 2026-05-20 00:44:49 +00:00
Sefa Eyeoglu
7cb14ad377 fetchPnpmDeps: fix pnpm 11 environment configuration
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2026-05-19 18:20:38 +02:00
nixpkgs-ci[bot]
167c482ea6 Merge master into staging-next 2026-05-14 00:41:55 +00:00
Gergő Gutyina
bc164958aa fetchPnpmDeps: deprecate fetcherVersion = 2, schedule removal for 26.11 (#518360) 2026-05-13 21:29:30 +00:00
K900
c11500a253 Merge remote-tracking branch 'origin/master' into staging-next 2026-05-12 22:39:18 +03:00
Sefa Eyeoglu
7d318dfe3b pnpm_11: init at 11.1.0
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2026-05-11 23:13:15 +02:00
Sefa Eyeoglu
83ace87bc7 fetchPnpmDeps,pnpmConfigHook: add support for pnpm 11
pnpm 11 does not support configuring some options through its new global
config format. As a workaround, we can define these environment
variables instead.

This also adds support for the new pmOnFail option in pnpm 11 that
replaces managePackageManagerVersions.

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2026-05-11 18:09:20 +02:00
Sefa Eyeoglu
359a8ab763 fetchPnpmDeps: use writableTmpDirAsHomeHook
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2026-05-11 18:09:20 +02:00
Sefa Eyeoglu
9212518207 pnpm-fixup-state-db: init at 1.0.0
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2026-05-11 18:09:20 +02:00
Aliaksandr
f472a6385b fetchPnpmDeps: deprecate fetcherVersion = 2
Extend the existing v1 deprecation warning to also fire for
`fetcherVersion = 2`, since callers should migrate directly to
`fetcherVersion = 3`. Both pre-v3 versions now share a single
`lib.warnIf` keyed on `fetcherVersion < 3` and produce a message
parameterised by the offending version.

Consolidate the manual's version-history entries: the per-item
**Deprecated** and **Recommended** labels are replaced by a single
sentence above the list noting that v3 is recommended and v1/v2 are
scheduled for removal.

Add a release note mirroring the existing v1 entry.
2026-05-11 18:02:36 +03:00
nixpkgs-ci[bot]
29d1182ba8 Merge staging-next into staging 2026-04-27 00:34:08 +00:00
Sam Pointon
37955437a7 fetchPnpmDeps: don't fail on empty lockfile
If the lockfile is empty, no files will be put in the output directory. 
In this case, the find invocations produce an empty list of results. 
xargs' default behaviour is to always invoke its command at least once; 
if its input is empty, then its command will not be passed any 
filenames. This produces an invocation like `chmod 555`. chmod, however, 
fails in this case, expecting an operand. So we need to tell xargs not 
to invoke its command at all in the case of empty input.
2026-04-26 19:33:22 +01:00
nixpkgs-ci[bot]
3897d11ea5 Merge staging-next into staging 2026-04-26 18:16:05 +00:00
Aliaksandr
6b6d15b820 fetchPnpmDeps: deprecate fetcherVersion = 1, schedule removal for 26.11
fetcherVersion = 1 was kept around for backwards compatibility while
callers migrated to 2/3.

Emit a `lib.warnIf` warning pointing at the affected pname whenever v1
is used.

After 26.11 ships, a follow-up PR should drop 1 from
`supportedFetcherVersions` and clean up the dead v1 code paths in
default.nix, pnpm-config-hook.sh and serve.nix.

Also rewrite the manual section to recommend fetcherVersion = 3 for new
packages and mark v1 as deprecated/scheduled-for-removal in the
version history.

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2026-04-26 18:39:08 +03:00