haskell: add support for all of Hackage

The function "callHackage <name> <version>" generates build instructions for
the requested library version on-the-fly. All of Hackage is available. Note:
this code is brand-new, experimental, and it might change in the future. Don't
base production code on this feature yet.

Example usage:

  $ nix-shell -p 'haskellPackages.callHackage "cpphs" "1.19.3" {}' --run "cpphs --version"
  cpphs 1.19.3

  $ nix-shell -p 'haskellPackages.ghcWithPackages (self: [(self.callHackage "hsdns" "1.6.1" {})])' --run "ghc-pkg list hsdns"
  /nix/store/p6r81k2vb2pzy4wcvri6z9m492i0hg63-ghc-8.0.1/lib/ghc-8.0.1/package.conf.d
      hsdns-1.6.1
This commit is contained in:
Peter Simons 2016-06-11 19:21:19 +02:00
parent 52aad6c77d
commit 2862d272a6

View File

@ -8,6 +8,8 @@ let
inherit (stdenv.lib) fix' extends;
inherit (import ./lib.nix { inherit pkgs; }) hackage2nix;
haskellPackages = self:
let
@ -57,6 +59,8 @@ let
inherit mkDerivation callPackage;
callHackage = name: version: self.callPackage (hackage2nix name version);
ghcWithPackages = selectFrom: withPackages (selectFrom self);
ghcWithHoogle = selectFrom: