NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.58k stars 13.74k forks source link

Documentation: How to use `pkgs.yarn2nix-moretea.linkNodeModulesHook` #217252

Open l0b0 opened 1 year ago

l0b0 commented 1 year ago

Problem

I can't find any usage documentation or examples other than this comment:

This can be used as a shellHook in mkYarnPackage. It brings the built node_modules into the shell-hook environment.

How is it meant to be used in mkYarnWorkspace?

Basically, how do you set up a Nix shell with Yarn module executables on $PATH?

Proposal

Checklist

Ping @zimbatm as the original developer and @frontsideair because of this comment.

nixos-discourse commented 1 year ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-to-use-pkgs-yarn2nix-moretea-linknodemoduleshook-in-nix-shell/25609/1

zimbatm commented 1 year ago

I haven't touched this for a while. I recommend looking at npmlock2nix v2, if you can switch back to npm: https://github.com/nix-community/npmlock2nix/blob/master/API.md

l0b0 commented 1 year ago

Thanks for the tip, @zimbatm! I might look into that (using synp --source-file yarn.lock to convert the lock file) once it's more appropriate for my use case: