[Nix-dev] nix as a library

stewart mackenzie setori88 at gmail.com
Sat Jul 9 00:58:59 CEST 2016


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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160709/7005502e/attachment.html>


More information about the nix-dev mailing list