nix-community / yarn2nix

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

error: Use upstream https://github.com/moretea/yarn2nix #98

Open LinArcX opened 5 years ago

LinArcX commented 5 years ago

Hi. when i want to install yarn2nix, it give me an error:

nix-env -iA nixos.yarn2nix

warning: name collision in input Nix expressions, skipping '/home/linarcx/.nix-defexpr/channels_root/nixos'
error: Use upstream https://github.com/moretea/yarn2nix

And this is the output of: nix-shell -p yarn2nix --show-trace https://gist.github.com/LinArcX/849680b67c5d92682f6e8b9fb8b539de

zimbatm commented 5 years ago

yes, it was too much work to keep patches flowing both ways to yarn2nix was removed from nixpkgs. It also didn't work really well inside of nixpkgs because it depends on Import From Derivation which is not allowed in nixpkgs

LinArcX commented 5 years ago

Well, a temporary way to install yarn2nix:

nix-env -I yarn2nix=https://github.com/moretea/yarn2nix/archive/master.tar.gz -f '<yarn2nix>' -i yarn2nix -i yarn 
nightkr commented 5 years ago

You probably don't want to install Yarn2nix anyway. If you omit yarnNix from mkYarnPackage then it will be generated automatically at build time from your yarn.lock.

ghost commented 5 years ago

yes, it was too much work to keep patches flowing both ways to yarn2nix was removed from nixpkgs. It also didn't work really well inside of nixpkgs because it depends on Import From Derivation which is not allowed in nixpkgs

What do you suggest instead for packaging applications with nodejs dependencies in nixpkgs? I am about to suggest adding back yarn2nix to nixpkgs in https://github.com/NixOS/nixpkgs/pull/60788, because I could not find another way.

spinus commented 4 years ago

@petabyteboy I would agree, maybe it's won't be newest version, but at least some working one for a project or two. Alternatively, you could just repackage it inside your mkDerivation, just for the project and any other package would need to do the same.

ghost commented 4 years ago

yarn2nix has been added to nixpkgs and should be available as usual again, so I think this issue can beclosed.

thomashoneyman commented 4 years ago

Bumping this as indeed yarn2nix is available via nixpkgs under yarn2nix or yarn2nix-moretea.

spinus commented 4 years ago

@LinArcX have some time to check?

flokli commented 4 years ago

@petabyteboy do you have some ideas on how to keep this best in sync?

I'm a bit concerned about things like the mkYarnPackage and fixup_yarn_lock attributes in nixpkgs not necessarily being compatible/in sync with what the yarn2nix attribute is pointing to…

ghost commented 4 years ago

I think we have a pretty good method for updating the nixpkgs version with the update script. I usually run it when one of my PRs here was merged and also create a PR to update the nixpkgs version, because I usually need the fix in nixpkgs at some point. I'm not really aware of many changes that make the generated yarn.nix files incompatible with older versions of yarn2nix. If there are such changes, maybe they should be batched together as a major release, with a new yarn.nix file format version attribute?