The main usecase for this variable is to append --production to yarn
which now got a whole lot easier because you no longer need to repeat
the defaults.
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;`.
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`.
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
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
`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
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;).
@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
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.