MatrixAI/Haskell-Demo

Importing another haskell project as dependency

Closed this issue · 3 comments

At the moment, to import a haskell project setup like Haskell-Demo from another project, we need to call haskellPackages.callPackage on cabal.nix instead of default.nix.

{
  pkgs ? import ./pkgs.nix,
  haskellPath ? "ghc844"
}:
  with pkgs;
  let
    haskellPackages = lib.getAttrFromPath (lib.splitString "." haskellPath) haskell.packages;
    multihash = haskellPackages.callPackage (import ../hs-multihash/cabal.nix) {};
    drv = haskellPackages.callPackage (import ./cabal.nix) { inherit multihash; };
  in
    haskell.lib.buildStrictly (
      ...
    )

Need to update default.nix so that we can directly import it instead.

What do you mean by this:

Need to update default.nix so that we can directly import it instead.

I think we initially wanted be able to import the default.nix of the project being imported (hs-multihash in this case). Currently we have to import cabal.nix.

Right now this has been migrated to the callPackage pattern, so this is no longer a problem.