[Nix-dev] [***SPAM***] Dynamic Dependency Management by Calling External Programs from Nix

Ludovic Courtès ludo at gnu.org
Sat Oct 29 22:56:48 CEST 2011


Hi,

Shea Levy <shea at shealevy.com> skribis:

> The obvious example is the language-specific package managers. The
> fact that a tool like cabal2nix can be used to do nearly all of the
> maintenance of Haskell packages means that we suddenly have a set of
> nix expressions that are more like "object files" than source code:
> They can be completely automatically generated, and if they need to be
> edited manually, it's considered a bug in cabal2nix and any changes
> will be overwritten on the next autogeneration

Would something along these lines suit your needs (pseudo-code)?

  haskellPackages = import (stdenv.mkDerivation {
    name = "haskell-packages";
    src = http://haskell.org/.../;
    buildInputs = [ cabal2nix ];
    buildPhase = "cabal2nix $src";
    installPhase = "ensureDir $out && mv *.nix $out";
  }) { inherit ghc ... ; };

The fact that ‘import’ can take a computed path such as the output path
of a derivation allows for all sorts of crazy things.

Thanks,
Ludo’.



More information about the nix-dev mailing list