[Nix-dev] some questions

Eelco Dolstra eelco at cs.uu.nl
Sat Apr 7 20:43:54 CEST 2007


Erick Tryzelaar wrote:
> Another one. O'Caml has a restriction that if a library changes, then
> everything that uses that library needs to be recompiled. Can a nix be
> set up to do this?

Yes, in fact it pretty much happens that way automatically.  You'd have
all-packages.nix like this:

  ocaml = import .../ocaml { dependencies... };

  some_ocaml_lib = import ... { inherit ocaml ...; };

  some_app = import ... { inherit ocaml some_ocaml_lib; };

and you already have some_app installed, and you then change the Nix expression
for some_ocaml_lib and do a "nix-env -i some_app", then some_ocaml_lib and
some_app will both be rebuilt.

But it's important to note that this is "demand driven": the mere fact that
you've changed the Nix expression for some_ocaml_lib won't cause some_app to be
rebuilt, since it will continue to use the old version in the Nix store just
fine.  It's only when you ask to upgrade/reinstall some_app that it will rebuilt
everything whose dependencies have changed.

-- 
Eelco Dolstra | http://www.cs.uu.nl/~eelco



More information about the nix-dev mailing list