305 Commits
Author SHA1 Message Date
Antoine du HamelandGitHub af31201aef treewide: fix mentions for nodejs.python (#505334) 2026-04-17 12:22:39 +00:00
nixpkgs-ci[bot]andGitHub 2af179604c Merge master into staging-next 2026-04-08 18:27:42 +00:00
adisbladisandGitHub f557638126 importNpmLock: handle commit in resolved git url (#501077) 2026-04-08 16:15:14 +00:00
K900 b68eb306fc import-npm-lock: fix build with structuredAttrs 2026-04-08 13:04:26 +03:00
@mjonesandGitHub 9b331020db treewide: fix typo of NPM → npm (#506286) 2026-04-05 23:50:21 +00:00
·𐑑𐑴𐑕𐑑𐑩𐑤 a0d0b06495 treewide: fix typo of NPM → npm 2026-04-03 19:08:04 +07:00
JoandGitHub c9bffa83b0 build-support/node: prepare for structuredAttrs (#487974) 2026-04-01 11:05:15 +00:00
Antoine du Hamel 201ccf894a treewide: fix mentions for nodejs.python 2026-03-31 14:23:37 +02:00
nixpkgs-ci[bot]andGitHub 240225b8cd Merge staging-next into staging 2026-03-25 18:21:05 +00:00
ccicnce113424 4f0a7d184a pnpmConfigHook: disable version management before any execution of pnpm commands
This would prevent hanging when pnpm tries to download the version set in package.json.
2026-03-25 03:53:38 +08:00
Stefan Frijters d997cac9c2 build-support/node/import-npm-lock: use printf instead of echo
This is a shell builtin and is safer when dealing with large inputs:
it avoids possible 'argument list too long' errors.
2026-03-22 13:04:17 +01:00
Philip TaronandGitHub 6e613243b1 build-support/node/import-npm-lock: use structuredAttrs instead of passAsFile (#498929) 2026-03-22 06:20:58 +00:00
Winter M d370f2f878 importNpmLock: handle commit in resolved git url
npm's locking process resolves Git dependencies to a given commit, separated
by a `#`. Before this change, any encounter of these URLs would cause `fetchGit`
to fail, as they're not valid repo URLs.
2026-03-18 13:14:16 -04:00
nixpkgs-ci[bot]andGitHub 284fe9ab7b Merge master into staging-next 2026-03-18 00:24:50 +00:00
Linus Heckemann a15d4a443d linkNodeModulesHook: replace symlinks atomically
Up to now, existing symlinks were replaced by removing the existing link
and then creating a new one. This left a window where the link did not
exist, which would break cases where the hook was running concurrently
with other things using node_modules.

In my case, I would run multiple webpack builds at once like:

  nix develop -c webpack build --mode production
  nix develop -c webpack build --mode development

If one of the shells was ready faster than the other, webpack would
start running, then the second would run the linkNodeModules hook, and
the earlier webpack build would run into missing files as the second
linkNodeModules hook removed symlinks to replace them.


This change mitigates this race condition in two ways:

- Not replacing the symlink if it already points to the right target
  (this also avoids superfluous filesystem writes)

- Replacing the symlink atomically, using a rename,
  otherwise. The symlink was replaced atomically prior to
  db7050bb88 as well, but the name of the
  temporary symlink was always the same, which led to a similar race
  condition. This change reintroduces the atomic replacement, but adds
  the PID to the temporary filename in order to avoid conflicting with
  other instances of the hook running concurrently.
2026-03-17 16:09:18 +01:00
nixpkgs-ci[bot]andGitHub 3e72182ee9 Merge master into staging-next 2026-03-15 12:10:13 +00:00
Sefa Eyeoglu 890910d4c3 pnpm-config-hook: propagate writableTmpDirAsHomeHook
This should bring this in line with other packages in nixpkgs.

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2026-03-14 10:33:30 +01:00
Stefan Frijters e00cfe671f build-support/node/import-npm-lock: use structuredAttrs instead of passAsFile 2026-03-12 18:30:19 +01:00
Diogo Correia 2c52816160 prefetch-npm-deps: support file: scheme for dependencies
Fixes #484067
2026-03-12 15:03:52 +00:00
Stefan Frijters d66b335e05 build-support/node/build-npm-package: fix npm-config-hook.sh for structuredAttrs
Do not rely on npmDeps being exported.
2026-03-05 11:29:15 +01:00
nixpkgs-ci[bot]andGitHub fa073e0e32 Merge staging-next into staging 2026-02-25 18:24:25 +00:00
Doron BeharandGitHub decc06ee75 linkNodeModulesHook: respect NODE_PATH (#493427) 2026-02-25 17:41:43 +00:00
Linus Heckemann 345c0e2851 linkNodeModulesHook: respect NODE_PATH 2026-02-23 19:04:59 +01:00
nixpkgs-ci[bot]andGitHub ff3c954c55 Merge staging-next into staging 2026-02-16 18:13:07 +00:00
nixpkgs-ci[bot]andGitHub ae20412acf Merge master into staging-next 2026-02-16 18:12:30 +00:00
Philip TaronandGitHub 4fdfb71850 build-support/node/fetch-yarn-deps: move env variables into env (#487962) 2026-02-16 16:26:08 +00:00
Doron BeharandGitHub e26385b40c prefetch-npm-deps: warn about unresolved lockfile deps (#479805) 2026-02-16 15:33:49 +00:00
Doron BeharandJörg Thalheim 17aec4cda9 prefetch-npm-deps: warn about unresolved lockfile deps
Upstream projects' `package-lock.json` file might include many deps with
no resolved line in them, as described here:

https://github.com/npm/cli/issues/6301

This can cause dependencies to be missing after generating a hash for
`.npmDeps`. If such dependencies are encountered, it's nice to print
them and warn the user that an upstream patch might be needed.

Co-Authored-By: Jörg Thalheim <joerg@thalheim.io>
2026-02-16 12:00:34 +02:00
jopejoe1 58c1ec779f treewide: replace lib.trivial.version with lib.trivial.release 2026-02-16 09:45:06 +01:00
Jörg Thalheim 203662a570 prefetch-npm-deps: strip volatile fields from dist objects in packuments
The dist object in npm packuments contains fields that can change
after a package is published, causing hash mismatches in
fixed-output derivations:

  - signatures: changes when npm rotates registry signing keys
    (old key SHA256:jl3bwswu80Pjj... expired 2025-01-29)
  - npm-signature: legacy format being progressively removed
  - attestations: provenance metadata added post-publication

Only keep the three fields npm actually needs during install:
tarball, integrity, and shasum. Also strip the informational-only
fileCount and unpackedSize fields.

This is the same approach already used for top-level and
version-level field whitelisting.

Ref: https://github.com/numtide/llm-agents.nix/issues/2459
2026-02-15 18:09:32 +01:00
K900 15a6983bd3 Merge remote-tracking branch 'origin/master' into staging-next 2026-02-11 21:30:26 +03:00
Doron Behar f5c43ee489 yarnConfigHook: revert "prevent yarn from resolving dependencies using git"
This reverts commit 366191a9d1. Due to
regressions reported & discussed here:

- https://github.com/NixOS/nixpkgs/pull/488109#issuecomment-3877185185
- https://github.com/NixOS/nixpkgs/pull/489040
2026-02-11 15:29:08 +02:00
nixpkgs-ci[bot]andGitHub 83741d677f Merge master into staging-next 2026-02-09 12:17:08 +00:00
Doron Behar 366191a9d1 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;

```
2026-02-08 01:00:31 +02:00
Stefan Frijters 611910f00c build-support/node/prefetch-npm-deps: prepare for structuredAttrs
Move env variables into env, explicitly provide outputHash to
prefetch-npm-deps.
2026-02-07 15:07:00 +01:00
Stefan Frijters a048e93a8f build-support/node/fetch-yarn-deps: move env variables into env 2026-02-07 14:22:22 +01:00
K900 a146c68c7e Merge remote-tracking branch 'origin/staging-next' into staging 2026-02-04 10:09:04 +03:00
Sigmanificient f211cad9d9 fixup-yarn-lock: set pname and version 2026-02-04 00:55:33 +01:00
Sigmanificient f1c064f1c2 prefetch-yarn-deps: set pname and version 2026-02-04 00:55:20 +01:00
Jörg Thalheim e11702f1f1 prefetch-npm-deps: exclude deprecated field from packument whitelist
The 'deprecated' field can be modified by package maintainers at any time
via 'npm deprecate', even for already-published versions. This causes
hash mismatches when the npm registry adds deprecation notices to packages
that were previously not deprecated.

For lockfile-based installs, the version is already resolved, so the
deprecation hint used by npm-pick-manifest for version selection is not
needed. The only behavioral change is that users won't see deprecation
warnings during 'npm install', which is an acceptable tradeoff for
reproducible builds.

This was discovered when tar@7.5.2 was deprecated upstream, breaking
builds in downstream projects using fetcherVersion=2.
2026-01-20 09:11:24 +01:00
Philip TaronandGitHub 963873d175 prefetch-npm-deps: add cacheVersion for packument support (#470517) 2026-01-19 15:38:43 +00:00
nixpkgs-ci[bot]andGitHub 6b916b492a Merge master into staging-next 2026-01-15 10:01:58 +00:00
Jörg Thalheim 08e805c550 prefetch-npm-deps: normalize packuments using whitelist approach
Switch from stripping known volatile fields to using an explicit whitelist
of allowed fields. This is more robust against upstream changes that add
new fields which could affect hash stability.

Top-level: only name and versions (dist-tags and time not needed for
lockfile installs where versions are already resolved)

Version-level: identity, all dependency types, dist, bin, platform
constraints (engines/os/cpu), scripts, and deprecated flag.

Based on analysis of pacote, npm-pick-manifest, npm-install-checks, and
arborist - only fields actually read during npm install are included.
2026-01-11 21:20:39 +01:00
Gutyina Gergő 34398d3276 pnpm_10: 10.26.1 -> 10.28.0 2026-01-10 12:00:35 +01:00
Jörg Thalheim dbc8a3bc5c prefetch-npm-deps: normalize packuments for deterministic hashes
Fixed-output derivations for npm dependencies fail with hash mismatches
when rebuilt on different days. The root cause is that npm registry
metadata (packuments) contain volatile fields that change whenever
upstream publishes a new version.

For example, the TypeScript packument changes daily due to nightly
releases, even though the lockfile pins a specific version. The cached
packument includes _rev, time, modified, and the full versions list -
all of which drift over time.

Strip these volatile fields and filter the versions map to only include
versions actually referenced in the lockfile.

Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
2026-01-04 13:57:43 +00:00
Jörg Thalheim ab89ffc4b1 fetchNpmDeps: rename cacheVersion to fetcherVersion
To align with pnpm tooling.
2026-01-03 18:45:33 +00:00
Jörg Thalheim 0cb5de2d62 prefetch-npm-deps: use package name field for aliases
npm lockfiles can contain package aliases where the lockfile key differs
from the actual package name (e.g., "string-width-cjs" aliasing
"string-width"). Previously we always used the lockfile key, causing us
to fetch packuments for the wrong package.

Use the package's own "name" field when present, falling back to the
lockfile key. This ensures we fetch the correct packument for aliased
packages, fixing non-deterministic builds where the wrong packument
fetch could succeed or fail depending on network timing.
2025-12-31 07:53:32 +00:00
Jörg Thalheim 40f1b80ac7 prefetch-npm-deps: clarify backwards compatibility comment 2025-12-31 06:57:27 +00:00
Jörg Thalheim 3fb4fe294b prefetch-npm-deps: extract package names from lockfile keys
The current approach parses tarball URLs to extract package names for
packument fetching. This is fragile as it only handles npmjs.org URLs
and requires special-casing other registries.

Use lockfile keys directly instead. The lockfile already contains the
canonical package names in the form "node_modules/@scope/name", so we
can simply strip the prefix rather than parsing URLs.

This handles all registries uniformly and eliminates the URL parsing
code along with its tests.
2025-12-31 06:37:24 +00:00
Winter d028ea9cd8 npmConfigHook: suggest cache v2 when npm install fails 2025-12-31 00:37:52 -05:00