[Nix-dev] Simplify node packages?

Benno Fünfstück benno.fuenfstueck at gmail.com
Tue Apr 25 10:20:59 CEST 2017


>
> > This would only need a feature from upstream to use cached tarballs.
>
> npm uses the following algorithm:
> 1. resolve dependencies
> 2. move dependencies as far up the tree as possible to enable sharing
> 3. unpack the tarballs into the correct dirs
> 4. link the "bin" files into a .bin directory and the man files
>
> That’s it.
>

Well, perhaps that's the algorithm it uses right now, but I feel that we
depend very much on implementation details of npm here, which IMO is not a
good solution.
If we get upstream to support enough for our use case, the solution should
be much more stable.

I would like nixpkgs to move away from the approach of "mocking" things for
stupid package managers (creating files in certain directories) and instead
try to work with upstream to just implement the features we need. I'd even
volunteer to work on this myself, but I thought I'd ask if there are any
principal problems here first.


> > phase 1: build a directory full of tarballs (just symlink the result of
> > fetchurl without unpacking)
> > phase 2: let yarn assemble the dependency tree (thus it will deal with
> > cyclic dependencies for us)
>
> Right now it takes around 4–5 minutes to unpack the tarballs
> for my project with node2nix. That is on every dep change.
>

Hmm, so perhaps in we can unpack the tarballs already in `phase 1` and tell
yarn to just look in $DIR for unpacked tarballs? Yarn should already have
most of the code that is required for correct symlinking, no?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.science.uu.nl/pipermail/nix-dev/attachments/20170425/16ea6395/attachment.html>


More information about the nix-dev mailing list