[Nix-dev] Howto resolving dependencies automatically but much faster ?

Eelco Dolstra e.dolstra at tudelft.nl
Tue Dec 15 11:48:19 CET 2009


Hi,

Nicolas Pierron wrote:

> This should be easy to do implement a loading of dynamic libraries,
> but one of the issue is related to the compilation of these dynamic
> libraries.  Currently Nixpkgs and NixOS are interpreted and you can
> evaluate the result without any compilation ( nix-instantiate
> --eval-only ).  If you want to provide libraries, thus we have to
> compiled them locally to before any instantiation.  I would prefer to
> have an additional keyword similar to "import" where a Nix expression
> is injected inside the evaluation process.

"import" already support something like this, since you can import the result of
a derivation.  For instance:

  import "${runCommand ...}/output.nix"

For one application of this, see rpmClosureGenerator and makeImageFromRPMDist in
pkgs/build-support/vm/default.nix.  The former generates a Nix expression
(containing a list of fetchurl calls to download a set of RPMs) which is
imported by the latter.  Implementing the RPM closure generator would be rather
unpleasant in the Nix expression language.

However, importing a derivation shouldn't be used for packages in Nixpkgs,
because it causes operations like "nix-env -qa" to perform build actions.  This
is clearly undesirable.

Resolution of Hackage dependencies sounds like something that shouldn't be done
in Nix, but in the script that generates the Nix expressions from Hackage.

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/



More information about the nix-dev mailing list