Commit Graph

34 Commits

Author SHA1 Message Date
Robert Hensing
200175a701 config.allowAliases: Define as option
This simplifies usages and makes the default value consistent.

In a few cases, the default value was interpreted to be `false`,
but this is useless, because virtually nobody will explicitly
set `allowAliases = true;`.
2022-04-01 11:33:10 +02:00
Silvan Mosberger
c7b52869d8
Merge pull request #128119 from Simspace/yarn2nix-preserve-resolutions
yarn2nix: preserve top-level package.json resolutions field in workspace
2022-03-24 05:00:51 +01:00
Richard Wallace
9801e6e53d yarn2nix: preserve top-level package.json resolutions field in workspace
The `package.json` produced when building node_modules for a workspace
ignores the `resolutions` from the project `package.json`. This results
in dependencies being resolved in a way that conflicts with the
`yarn.lock` file. To fix this, we need to preserve the `resolutions`.
2022-03-23 14:34:01 -07:00
Thomas Baggaley
e3a60c19f8 yarn2nix: support new yarn workspace json 2022-03-05 00:27:42 -05:00
Jan Tojnar
ecb6f035e6 yarn2nix: Add support for nativeBuildInputs in pkgConfig 2022-01-28 17:41:25 +01:00
Jan Tojnar
b121d01d29
Merge pull request #119522 from AmineChikhaoui/yarn2nix-use-integrity-field
yarn2nix: use yarn lockfile integrity field whenever possible
2021-12-09 01:49:46 +01:00
AmineChikhaoui
487aaa905f yarn2nix: use yarn lockfile integrity field whenever possible
Whenever available use the SRI hashes from the integrity field to create
the fetchurl calls instead of entirely relying on the `resolved` sha1
which may or may not exist with recent yarn versions.

Related issues:

- https://github.com/nix-community/yarn2nix/issues/125
- https://github.com/NixOS/nixpkgs/issues/77238
2021-12-04 08:02:10 +01:00
Shamrock Lee
60950f739e lib/meta: add getLicenseFromSpdxId function
Move function spdxLicense, internally used in yarn2nix
to lib/meta.nix, and
rename to getLicenseFromSpdxId

A similar function is implemented in poetry2nix,
but the one originally in yarn2nix seems beter.
since it falls back to an license-like attrset
for mismatched case
instead of a plain string
2021-12-02 18:33:48 +08:00
Yureka
1d525f51fb yarn2nix: add nix-prefetch-git to PATH 2021-10-31 14:37:51 +01:00
Yureka
7bec541117 yarn2nix: no sha1 for github tarballs
Since b27d18a412 we fetch packages with codeload.github.com tarballs as
resolved field with fetchgit. The sha1 of the tarball is irrelevant,
instead nix-prefetch-git will be used to determine the expected fetchgit
FOD hash.

Fixes #143828
2021-10-31 14:37:51 +01:00
Yureka
84e02be598 fetchYarnDeps, mkYarnModules: verify the FOD hash is up-to-date 2021-10-20 11:39:16 +02:00
Yureka
cf6f772676 mkYarnModules: allow passing custom offlineCache 2021-10-20 11:39:16 +02:00
Yureka
30aeeaded4 yarn2nix: fix running without --no-patch 2021-10-14 18:46:22 +02:00
Yuka
4c7e1a10b4
yarn2nix: fix "rev is not defined" (#141207)
Must have slipped in when incorporating comments on #136922
2021-10-10 23:30:24 +02:00
Yureka
b7e7d35ccc yarn2nix: workaround for NixOS/nix#5128 2021-10-10 16:26:47 +09:00
Yuka
b27d18a412
yarn2nix: handle codeload.github.com uris in IFD mode (#136922) 2021-10-08 14:18:57 +02:00
Maximilian Bosch
ca4e61d586 yarn2nix: run nix-prefetch-git with --fetch-submodules
`pkgs.fetchgit` uses `fetchSubmodules = true;` by default, however
`nix-prefetch-git` doesn't. This means that hashes for a Git repository
with fetched submodules will be wrong in `yarn.nix`.

Considering that this got unnoticed before, it seems as if this case is
an exception to a certain degree.

An exemplary problem is the last `hedgedoc` update[1] where
`js-sequence-diagrams` - a Git repo with submodules - from upstream's
package.json caused a hash mismatch. This got unnoticed because
`nix-build --check` doesn't seem to reveal these issues for fixed-output
derivations.

[1] https://github.com/NixOS/nixpkgs/pull/139238
2021-09-26 21:05:28 +02:00
Felix Buehler
6ee7f33833 yarn2nix: replace simple mkDerivation with runCommandLocal 2021-08-22 19:35:42 +09:00
Felix Buehler
43b5d5ae70 yarn2nix: deprecate phases 2021-08-16 22:37:41 +02:00
Robert Hensing
a201246bac treewide: runCommandNoCC -> runCommand in generated code
This has been synonymous for ~5y.

Note that many of these runCommand bindings are unused, but that's
ok for generated code.
2021-08-15 17:36:41 +02:00
Robert Hensing
0d859a070e yarn2nix-moretea: Generate runCommand instead of -NoCC
This has been synonymous for ~5y.
2021-08-15 17:36:41 +02:00
Sandro
476f69bc5e
Merge pull request #101521 from egasimus/patch-2 2021-06-09 12:54:50 +02:00
Maximilian Bosch
fea2b25c74 yarn2nix: set name to ${pname}-${version} by default 2021-06-02 19:21:31 +09:00
lassulus
79723fcfb8 yarn2nix: remove deprecated yarn2nix fetch script 2021-01-01 21:30:49 +01:00
lassulus
23d75e6be0 yarn2nix: improve naming regexes
Originally submitted in https://github.com/nix-community/yarn2nix/pull/128
2021-01-01 21:30:43 +01:00
lassulus
6e687b6325 yarn2nix: yarn update 2021-01-01 17:35:05 +01:00
lassulus
32c9918ba6 yarn2nix: Handle codeload.github.com tarballs
This was submitted originally in https://github.com/nix-community/yarn2nix/pull/130
2020-12-30 19:01:48 +01:00
Gabriel Ebner
b184f8f883 mkYarnPackage: allow overriding version 2020-12-13 13:42:56 +01:00
Adam Avramov
4ef1e5b8de yarn2nix: expose yarnPostBuild
The way I see it, there's no point in the argument being there if it can't be used.
Right now its lack currently prevents a workaround for an issue I can't wrap my head around - first encountered [here](https://logs.nix.samueldr.com/nixos-dev/2019-08-28#2532857;).
2020-12-08 23:54:40 +01:00
Maximilian Bosch
0c49f1896e
yarn2nix-moretea: re-add support for git:// URLs from yarn.lock
@lheckemann already added it to `yarn2nix` a while ago[1], but it seems
as it was forgotten to include when adding `yarn2nix` sources to
`nixpkgs` itself.

Without this patch, you cannot add dependencies to your `package.json`
with URLs like `git://github.com/.../` as building the expression would
fail like this:

```
curl: (1) Protocol "git" not supported or disabled in libcurl
error: cannot download git___github.com_sstur_nodeftpd.git from any mirror
```

Co-authored-by: Linus Heckemann <git@sphalerite.org>

[1] https://github.com/nix-community/yarn2nix/pull/141
2020-10-09 09:55:35 +02:00
Silvan Mosberger
75ee18766a
yarn2nix: Don't pass yarnNix to mkDerivation (#92856)
The generated yarnNix file doesn't need to be part of the mkDerivation.
And doing so prevents other platforms from reproducibly instantiating
it. With this change you can e.g. do

  darwinPkgs.yarn2nix.mkYarnPackage {
    # ...
    yarnNix = pkgs.yarn2nix.mkYarnNix {
      yarnLock = ./yarn.lock;
    };
  }

Which is a darwin derivation, but can still be instantiated reproducibly on Linux.
2020-07-10 16:24:03 +00:00
Milan
ed90e59fc2 yarn2nix-moretea: v1.0.0-36-g3f2dbb0 -> v1.0.0-39-g9e7279e (#73911)
Includes the following upstream commits:

- Fix for package.json without a version (moretea/yarn2nix#113)
- Don't access package.json via filtered src (moretea/yarn2nix#115)
- remove redundant rec (moretea/yarn2nix#119)
2019-11-22 14:27:11 +00:00
volth
08f68313a4 treewide: remove redundant rec 2019-08-28 11:07:32 +00:00
WilliButz
f748b501e8
yarn2nix-moretea: init at 2019-04-10 2019-07-25 17:15:00 +02:00