[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

haskellRelease needs to take system packages into account

Some Haskell packages (e.g. zlib) require system packages (e.g. zlib).
Since there's a name clash, we need to figure out which of the arguments
should come from nixpkgs and which from (the overridden)

We do this already for the non-derivation version. It calls each Haskell
function with a dummy 'mkDerivation' function, which spots those
dependencies which are used for the system deps. We could do a similar
thing, e.g. supplying strings as arguments (i.e. 'foo' gets the value
'"foo"') and seeing which strings come back.

Trickier would be to make calling these functions easy for our
'override' function. One way would be to augment the list of names that
we're already defining. We could instead define an attrset, whose names
are the Haskell package names (hence we can recover the existing
behaviour via 'attrNames', along with the extra guarantee that there are
no duplicates!) and the values are lists of system packages. We can do
this by calling a function like the following, as the value of each

    name: with rec {
      func    = import (./. + "/pkgs/${name}.nix");
      args    = attrNames (functionArgs func);
      dummies = listToAttrs (map (x: { name = x; value = x; }) args);
      sysArgs = func (dummies // {
        mkDerivation = args: args.librarySystemDepends or [];
      sysPkgs = listToAttrs
        (map (name: { inherit name; value = getAttr name pkgs; })
    haskellPackages.callPackage func sysPkgs;