nix-community / yarn2nix

Generate nix expressions from a yarn.lock file [maintainer=???]
GNU General Public License v3.0
123 stars 61 forks source link

aborts due to changes to yarn.lock that it introduces itself #110

Open tokudan opened 5 years ago

tokudan commented 5 years ago
building '/nix/store/f7mf5zck7las5dlf258zkzlhfc1x469n-yarn.nix.drv'...
found changes in the lockfile /nix/store/kq1yxzvik2gvs7a99jwcfsyzrnyf2lw4-source/yarn.lock
...aborting

The project I'm building (https://github.com/hopglass/hopglass/) provides a yarn.lock that I use to build it. Apparently yarn2nix changes yarn.lock and then complains about the changes. Example code: https://gist.githubusercontent.com/tokudan/55be884cf1f274dbeae3098f5afab062/raw/9a7ff0cc84051f568adcdb890500ab7777710b45/hopglass.nix

chekoopa commented 4 years ago

Bump, same thing.

chekoopa commented 4 years ago

Apparently, the reason is in the code. https://github.com/moretea/yarn2nix/blob/9e7279edde2a4e0f5ec04c53f5cd64440a27a1ae/bin/yarn2nix.js#L71-L77

So, when you're building, yarn2nix tries to change the lockfile, but fails and aborts, as it's run with --no-patch flag. The workaround is running yarn2nix --no-nix to patch it before building (the flag is just to avoid unnecessary config spam, unless you're up to write yarn.nix).