[Nix-dev] Reengineered npm2nix: call for feedback

Sander van der Burg svanderburg at gmail.com
Tue Oct 21 22:17:14 CEST 2014


I think the problem with relative paths is solved now. Now the directory in
which the package.json file resides is also taking into account in the
generation process.

I tested it against a simple custom-made testcase.

On Fri, Oct 17, 2014 at 10:54 AM, Sander van der Burg <svanderburg at gmail.com
> wrote:

> Ah a path issue! Well spotted!
>
> I only discovered this new feature of NPM while writing my blog post and
> realized that I have only tested absolute paths so far, not relative paths.
> I'll implement a fix for this soon!
>
>
> On Thu, Oct 16, 2014 at 11:36 PM, Colin Putney <colin at wiresong.com> wrote:
>
>>
>>
>> On Tue, Sep 30, 2014 at 3:13 AM, Sander van der Burg <
>> svanderburg at gmail.com> wrote:
>>
>>
>>> I've used the reengineered npm2nix on a private project for the company
>>> I work for, as well as some other utilities and it seems to work fine for
>>> me.
>>>
>>> Hopefully, you can also try npm2nix on your projects to find out whether
>>> there any additional issues. :)
>>>
>>> Furthermore, I'm still working a blog post to rationalize all the stuff,
>>> which should give you better insights in the problem, details and the
>>> choices I made.
>>>
>>> Let me know what you think!
>>>
>>
>> Hi Sander,
>>
>> I've just tried out this version and I'm finding it pleasant improvement
>> over the old way. The generated code is clean and simple, and I like the
>> minimal dependency it has on nixpkgs.
>>
>> However, there's one thing I haven't been able to get working: local path
>> dependencies.
>>
>> I have several node apps that rely on a collection of node modules. These
>> modules may, in turn rely on other modules. In addition, both the apps and
>> the modules depend on modules from npm. My current setup involves
>> generating nix expressions using npm2nix (Sheay's version) to get the NPM
>> dependencies, then hand-editing the default.nix files for each app and
>> module, to pull in the additional dependencies that don't come from npm.
>>
>> As of NPM 2.0, dependencies can be specified as paths on the local file
>> system, and I'd like to use that feature to generate nix expressions for
>> both local and npm dependencies using npm2nix. It almost works, but not
>> quite. AFAICT, the nix expressions are generated just fine, but then when
>> the derivation is being created, the relative paths are resolved against
>> the current directory of the of the process, rather than against the
>> directory that contains the package.json file. That causes the derivation
>> to fail with ENOENT.
>>
>> All in all, looks like big improvement!
>>
>> Colin
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20141021/793d6288/attachment.html 


More information about the nix-dev mailing list