[Nix-dev] Reengineered npm2nix: call for feedback

Luca Bruno lethalman88 at gmail.com
Sun Oct 12 19:50:31 CEST 2014


Thanks a lot for your effort. I've tried your npm2nix with this json:
https://github.com/lethalman/reghome/blob/master/pkgs/node-packages.json

First of all, it's the first time I've seen a git clone during the npm2nix
process, probably because now your branch considers npm branches (Cloning
git repository: https://github.com/ariya/esprima.git branch harmony). I
think that's wanted.

*PERFORMANCE*
It takes 4 minutes to generate the .nix expression, whereas the old npm2nix
only takes 12 seconds. I think it's too much, I hope it's not impossible to
improve the situation. However before I start digging looking at the code,
there are some bigger (in my opinion, from my personal usage) problems
listed below.

*BIG BUG*
It creates a default.nix in the current directory, so it replaced my own
default.nix. I've run npm2nix -i pkgs/node-packages.json -o
pkgs/node-packages.nix . Please only generate that pkgs/node-packages.nix,
not any other .nix file, nor node-env, nor default.nix, nothing.

*PERSONAL REGRESSION*
Before I was able to call my pkgs/node-packages.nix by only passing self,
now it needs more arguments. Not allowing to pass self is bad for
overriding packages.
How would you go about overriding a package in the generated expression so
that other expressions can use it as new dependency? By passing self you
could do it.
Is it hard to keep using self instead of using that inaccessible registry
variable?

*PERSONAL REGRESSION*
Before this rework, by specifying e.g. [ "foo", "bar" ] in the
node-packages.json, "foo" and "bar" were exported, and all other packages
were in some other attribute set (e.g. by-version). This allowed me to peek
only the wanted dependencies of my project like this:

lib.collect lib.isDerivation myNodePackages

So that I could use that for buildInputs of my env, and for paths in a
buildEnv (see https://github.com/lethalman/reghome/blob/master/default.nix)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20141012/db97d6ec/attachment.html 


More information about the nix-dev mailing list