[Nix-dev] Reengineered npm2nix: call for feedback

Sander van der Burg svanderburg at gmail.com
Sun Oct 12 21:42:58 CEST 2014


Hi,

Regarding the generation performance: that's improvable, and as a matter of
fact, I'm working on something right now. However, build performance is a
bit more difficult to answer (see my previous e-mail).

About default.nix: The actual file that's generated can be named
differently with the following parameter: -c someotherfile.nix. I'm
thinking about merging all the output files together. However, my personal
preference is to keep them seperate because one file is generated and the
other is written statically. Also I find it better (personally) to have
some concerns separated, but there is no strong reason against merging them
in the end, since we rely on generation anyway.

Currently, the generated packages are not overridable, but I think it's
better to have the ability to do so. It's simply that I don't have
consciously thought about that.

About your final use case: if I understand you correctly, you want some
means that allow you to query all dependencies of the set of packages in
node-packages.json, without the packages themselves? And from that you want
to compose an environment?


On Sun, Oct 12, 2014 at 7:50 PM, Luca Bruno <lethalman88 at gmail.com> wrote:

> 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/26107bda/attachment.html 


More information about the nix-dev mailing list