Commit Graph

65 Commits

Author SHA1 Message Date
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
Antoine du Hamel
617b299a40 fetch-yarn-deps: remove unused nodejs argument 2026-05-28 11:36:13 +02:00
Sigmanificient
0bbc8dffae treewide: set meta.license on hooks 2026-05-25 13:48:20 +02:00
Doron Behar
7add9a7657 yarn2nix: remove more mentions of it 2026-04-26 09:50:54 +03:00
Philip Taron
4fdfb71850 build-support/node/fetch-yarn-deps: move env variables into env (#487962) 2026-02-16 16:26:08 +00:00
jopejoe1
58c1ec779f treewide: replace lib.trivial.version with lib.trivial.release 2026-02-16 09:45:06 +01: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
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
a048e93a8f build-support/node/fetch-yarn-deps: move env variables into env 2026-02-07 14:22:22 +01: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
dish
86fb272649 yarnInstallHook: add meta.description
Makes search.nixos.org give the correct location for the package and
also helps users better understand it
2025-11-24 12:14:54 -05:00
Alexander Sieg
2323653633 fetch-yarn-deps: follow relative redirects 2025-08-11 18:02:56 +02:00
Wolfgang Walther
3d4c1c0d26 .editorconfig: two spaces for .js files
Most other scripting languages we use in tree have the same.
2025-06-23 14:54:45 +02:00
Doron Behar
9732e5125c prefetch-yarn-deps: fix resolving of local packages using file: (#387313) 2025-04-29 18:23:14 +03:00
K900
460cbc8c6c prefetch-yarn-deps: don't explicitly depend on nixForLinking
See: https://github.com/NixOS/nixpkgs/pull/395147
2025-04-07 21:51:59 +03:00
jade
31f7f3fc9e nixForLinking: init (#384099) 2025-03-12 10:13:54 -07:00
Yureka
c1c82774ae yarnConfigHook: add yarn.lock consistency check (#387316) 2025-03-05 21:16:12 +01:00
Robert Sliwinski
2bcc3b96f1 prefetch-yarn-deps: fix resolving of local packages using file:
Without this change local packages would get rewritten to resolve to
something that cannot be found at yarnpkg.com

Example from a package prior this change:

Excerpt from `yarn.lock`:
```
@fortawesome/fontawesome-pro@file:./pkg/fortawesome-fontawesome-pro-6.3.0.tgz
file_._pkg_fortawesome_fontawesome_pro_6.3.0.tgz
```

The `yarnConfigHook` results in:
```
> Executing yarnConfigHook
> yarn config v1.22.22
> success Set "yarn-offline-mirror" to "/nix/store/r02716lg5ric6rihpnh75lrmpdw9mwv4-offline".
> Done in 0.02s.
> yarn install v1.22.22
> [1/4] Resolving packages...
> [2/4] Fetching packages...
> error Can't make a request in offline mode ("https://registry.yarnpkg.com/file_._pkg_fortawesome_fontawesome_pro_6.3.0.tgz")
```
2025-03-05 15:59:19 +01:00
Rebecca Turner
f4d32e0200 nixForLinking: init
Overlays for CppNix nightly, Lix, or Tvix want to change the default Nix
implementation in Nixpkgs by overriding `pkgs.nix`. However, some
packages link against the internal/unstable CppNix APIs directly, and
these packages will break if built with different versions or
implementations of Nix.

If you want to swap out the Nix implementation in your package set, you
don't want these packages to break. Therefore, some packages will refer
to `nixForLinking` explicitly, at least until these dependencies can be
sorted out.

The addition of an explicit `nixForLinking` attribute decoupled from
`nix`, which is just "a Nix implementation", will help Nix
implementation maintainers test Nix implementations in Nixpkgs with
minimal hassle.
2025-02-27 09:44:32 -08:00
Austin Horstman
2e86b37d72 yarnConfigHook: fix darwin permissions 2024-12-26 00:11:34 -06:00
Sefa Eyeoglu
7779a86836 Fix Codeql findings in update scripts (#342541) 2024-12-01 12:17:24 +01:00
Doron Behar
796699f22b fetch-yarn-deps: handle packages that are locally linked (#342186) 2024-09-29 22:59:39 +03:00
Mathieu Rene
2462edca10 fetch-yarn-deps: handle packages that are locally linked 2024-09-29 14:14:45 -04:00
lelgenio
c499cb1399 yarnInstallHook: fix temporary directory location
Currently the directory is being created in $src/yarnInstallHook.XXXXXX
Giving the directory a readable name is not particularly useful
2024-09-17 16:01:33 -03:00
Sandro Jäckel
a9c9441997 fetch-yarn-deps: fix "Incomplete URL substring sanitization"
'https://codeload.github.com' may be followed by an arbitrary host name.
2024-09-17 15:17:59 +02:00
Doron Behar
d77ecc757a fetchYarnDeps: fix by deduplicating requests (#336784) 2024-09-10 18:17:48 +00:00
Fea
207072fca3 fetchYarnDeps: fix by deduplicating requests 2024-09-09 23:39:44 +02:00
lelgenio
7783e118af yarnInstallHook: init 2024-09-04 11:15:47 -03:00
seth
278e1bfb89 yarnConfigHook: apply as a postConfigure hook
This follows in this example of npmConfigHook and allows for using this
hook alongside others that may override configurePhase
2024-08-28 23:30:55 -04:00
Adam Joseph
9cac7a7475 fetch-yarn-deps: improve diagnostic messages
When the hash of an url being fetched does not match the expected value, this
commit will cause fetch-yarn-deps to include the url in the error message to
assist debugging.
2024-07-25 11:37:44 +02:00
Adam Joseph
84a75e9488 fetchYarnDeps: fix broken fetching logic for github releases
When a dependency references a github *release* URL, that dependency must be
fetched using https rather than git, since github does not require that
release tarballs have any relationship whatsoever to the git history.

This commit causes them to be fetched using https, not git.

A test case (which fails prior to this commit, and passes afterwards) is included.
2024-07-25 11:37:39 +02:00
Doron Behar
2400268a38 fetch-yarn-deps: handle yarn.lock deps without a resolved url 2024-07-10 09:39:10 +03:00
Doron Behar
ee7cfec5aa doc/javascript: document yarn{Config,Build}Hook 2024-07-10 09:39:03 +03:00
Doron Behar
296556a320 yarnBuildHook: init 2024-07-10 09:39:02 +03:00
Doron Behar
a84f3ca3d8 yarnConfigHook: init 2024-07-10 09:39:02 +03:00
Doron Behar
1151b39c24 fetch-yarn-deps: format with nixfmt (RFC166) 2024-07-10 09:39:01 +03:00
Atemu
882cf18005 fetch-yarn-deps: reference files to be copied directly
This would cause any drv to be rebuilt when any part of the default.nix changes.
What we actually care about is the two JS files though, so simply reference them
directly.

Co-authored-by: Infinidoge <infinidoge@inx.moe>
2024-06-14 17:53:18 +02:00
Infinidoge
efff2acc5b fetchYarnDeps: properly accept src argument 2024-06-14 11:18:10 -04:00
Sandro Jäckel
6181939cdf fixup-yarn-lock: split out from prefetch-yarn-deps, cleanup installing
To reduce dependencies (mainly nix-prefetch-git and through that git,
git-lfs) when we just need to fixup a lock file, eg when building electron.
This also tries to avoid needless rebuilds when eg. golang is updated.

Also this cleans up and combined the build/installPhase of both tools to
be a lot simpler.
2024-04-17 11:35:22 -04:00
Lily Foster
25596bd419 Merge pull request #257337 from lorenzleutgeb/yarn-file
prefetch-yarn-deps: Fix handling of scoped packages
2023-11-26 16:49:33 -05:00
Sandro Jäckel
f16843cb31 fetch-yarn-deps: fix missing cert when fetching packages
Found while updating element-web
2023-11-22 21:25:36 +01:00
Lorenz Leutgeb
29cf6a0422 prefetch-yarn-deps: Fix access to .resolved
... and simplify `prefetchYarnDeps`
2023-11-22 18:03:48 +01:00
Lorenz Leutgeb
3843224a55 prefetch-yarn-deps: Fix parsing of scoped packages 2023-11-22 18:03:06 +01:00
Lily Foster
ab99231a36 prefetch-yarn-deps: add cacert to provide certificates during fetches
Ideally fetch-yarn-deps could do like some other fetchers and support
using SSL_CERT_FILE if it exists and also only verify integrity on FOD
hash unless using an empty/test hash.

But this should keep at least the same semantics as before the recent
Node.js change to stop using the built-in certificate store in favor of
the system one (which does not exist by default in the build sandbox).
2023-11-21 16:24:57 -05:00
Lily Foster
d02eb2d0e5 prefetch-yarn-deps: re-add git hash for fixup 2023-11-15 21:02:52 -05:00
Dan Buch
14f76a96e8 fetch-yarn-deps: warn on undefined expected hash
instead of rejecting, given that the expected hash may not be known/provided.
2023-09-27 00:17:40 +00:00
nicoo
fab52fca51 treewide: sha512 → hash 2023-09-22 18:37:42 +02:00
MicroBlock
c2b8bf7f4e feat: implement redirect for fetch-yarn-deps
This would fix NixOS/nixpkgs#245415
2023-07-26 15:13:37 +08:00
Lily Foster
249efd2271 Merge pull request #223457 from lilyinstarlight/fix/fetch-yarn-deps-pulsar
fetchYarnDeps: account for more yarn.lock spec edge cases
2023-07-16 20:24:16 -04:00