[Nix-dev] nix as a library

zimbatm zimbatm at zimbatm.com
Sat Jul 9 13:09:58 CEST 2016


How would the interface to the nix library look like for your use case?

Unless the data is closely weaved together I think you could achieve
reasonable speed communicating with the nix-daemon over a socket. The
dependencies don't need to be part of the editor if you can ask the nix
daemon to instantiate arbitrary nix code.

On Fri, 8 Jul 2016, 23:59 stewart mackenzie, <setori88 at gmail.com> wrote:

> Hmm okay, I have a use case then.
>
> We're building a data flow editor in fractalide. As component oriented
> styles of programming makes the concept of data flowing through a system to
> be a first class citizen, the editor merely enhances this data flow
> manipulation to a few points and clicks. It's what allows for trivial
> reusability of components.
>
> Now if we couldn't load a nix library we'd have to make every single
> component a dependency of this editor. This is undesirable, as the build
> time would be too long. Besides, Fractalide is designed to have 1000s of
> components and you'll only compile what you need per app.
>
> It's much better to make this hypothetical nix library be the only
> dependency of the editor, thus when you need/create a (new) component in
> the editor, the editor fires up the component build via the nix library.
> The editor would have adequate intelligence to libload once the build
> succeeds, or allow you to debug the code. (vapourware)
>
> This way, we wouldn't have to 'pop' fractalide out of nix to allow such
> dynamic editor behaviour, but instead we'd completely embrace nix.
>
> Why a C interface? Well most languages can handle the C ABI, so it would
> be useful, otherwise only C++ apps could load the library. Besides, we're
> using Rust and that won't interact with the C++ ABI. (C++ ABI is a complete
> train smash). Probably http://www.swig.org could do a nice enough job of
> providing an interface to whatever language needs access to nix
> functionality.
>
> Would be great to hear if anyone else has this use case.
> On 9 Jul 2016 05:52, "Vladimír Čunát" <vcunat at gmail.com> wrote:
>
>> On 07/08/2016 12:53 PM, stewart mackenzie wrote:
>> > Are there any plans to make nix's functionality into a library so that
>> > a programmer could include these libraries and affect change to the
>> > system via a program they made?
>> >
>> > (keeping a C ABI so that it'll work with libffi)
>>
>> There's been some discussion on that point already, but AFAIK noone has
>> produced a use case where using C interface would be significantly
>> superior to using CLI interface (which has to be maintained reasonably
>> stable anyway).
>>
>> --Vladimir
>>
>>
>>
>> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>
>> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160709/9b92a0b2/attachment.html>


More information about the nix-dev mailing list