Closed arianvp closed 6 years ago
This only seems to show up if src != ./.
if that helps...
let pkgs = import <nixpkgs> {}; in
pkgs.yarn2nix.mkYarnPackage rec {
name = "vault-ui";
src2 = pkgs.fetchFromGitHub {
owner = "hashicorp";
repo = "vault";
rev = "v0.11.2";
sha256 = "0lckpfp1yw6rfq2cardsp2qjiajg706qjk98cycrlsa5nr2csafa";
};
src = "${src2}/ui";
}
doesn't work.
whilst this works. Only difference being the src
directive :/
git clone git@github.com:hashicorp/vault
cd vault
let pkgs = import <nixpkgs> {}; in
pkgs.yarn2nix.mkYarnPackage rec {
name = "vault-ui";
src = ./ui;
}
Smaller reproduce:
let
pkgs = import <nixpkgs> {};
src = "${pkgs.fetchFromGitHub {
owner = "hashicorp";
repo = "vault";
rev = "v0.11.2";
sha256 = "0lckpfp1yw6rfq2cardsp2qjiajg706qjk98cycrlsa5nr2csafa";
}}/ui";
in
pkgs.yarn2nix.mkYarnNix "${src}/yarn.lock"
The error seems to come from the yarn2nix
binary itself
When I run yarn2nix
manually (and thus have network, because outside of the nix sandbox) I get:
[arian@t430s:~/Projects/vault]$ yarn2nix --no-patch --lockfile /nix/store/dk3xs6za5ajgmkd1pmwqn761bdnkzjph-source/ui/yarn.lock
found changes in the lockfile /nix/store/dk3xs6za5ajgmkd1pmwqn761bdnkzjph-source/ui/yarn.lock
Is there a way to force yarn2nix
to no try to update yarn.lock
? I want to use the vendored version.
--no-patch
doesn't seem to do it. eventhough it says so on the tin
Related to https://github.com/moretea/yarn2nix/issues/65
Apparently, yarn2nix parses codeload.github.com
urls incorrectly, causing it to think that there's no hash
Ah apparently it isn't implemented yet: https://github.com/moretea/yarn2nix/issues/1
The total problem:
Vault has yarn.lock
dependencies like:
Duration.js@icholy/Duration.js#golang_compatible:
version "2.0.0"
resolved "https://codeload.github.com/icholy/Duration.js/tar.gz/cb1c58efc2772ef0f261da9e2535890734a86417"
dependencies:
chai "~1.7.2"
mocha "~1.13.0"
Because git dependencies do not contain the SHA hash, yarn2nix
tries to update these in the .lock
file by modifying it. However, if this lock file
is inside the /nix/store
than this can't be modified and it fails.
Also, if it gets executed in side a nix
derivation, there's no network access, so it also fails.
I don't think we can really solve this easily, except from running yarn2nix
externally
We've seen that this problem occurs when yarn.lock
is generated by an older version of yarn which doesn't assign hashes to every package. This causes yarn2nix to try to fetch the files to calculate them which breaks when called from mkYarn2nix
. A workaround is to use a version of yarn >= 1.10.1 which always includes an "integrity" field with a hash which satisifies yarn2nix.
thanks @albertov , added to the README
This is still happening to me, even when I generate a fresh lockfile with yarn 1.15.2.
The entry in package.json:
"emoji-mart": "Gargron/emoji-mart#build",
yarn.lock does not contain a hash for this entry.
When calling mkYarnPackage I am using a local path as source:
src = /home/pbb/proj/mastodon/;
maybe, or maybe it's a similar but different issue. It's better to create a new issue with a repro so that it can be triaged properly
I get