How to combine these two derivations?

I am working on a miso ghcjs project. Since getting ghcjs is so hard, the author provides a default.nix that gets you up and running quickly:

with (import (builtins.fetchTarball {
  url = "";
  sha256 = "1yb9yvc0ln4yn1jk2k5kwwa1s32310abawz40yd8cqqkm1z7w6wg";
}) {});
pkgs.haskell.packages.ghcjs.callCabal2nix "app" ./. {}

This was working great, but I need a package not available on <nixpkgs>, namely morpheus-graphql-client. So when I depend on that in my project’s app.cabal file, I get the following error:

error: anonymous function at /nix/store/vwxsd8yn4iqnh0primn4pbgr3sp9288l-cabal2nix-app/default.nix:1:1 called without required argument 'morpheus-graphql-client'

So I need to provide morpheus-graphql-client to my project’s nix file. On a “normal” haskell project, I would create a nix file for the package like this:

cabal2nix cabal://morpheus-graphql-client > morpheus-client.nix

Then, I would override nixpkgs with the following

  config = {
    packageOverrides = pkgs: rec {
      haskellPackages = pkgs.haskellPackages.override {
        overrides = haskellPackagesNew: haskellPackagesOld: rec {
          project =
            haskellPackagesNew.callCabal2nix "project" ./. { };

          morpheus-graphql-client =
            haskellPackagesNew.callPackage morpheus-client.nix { };

  pkgs = import <nixpkgs> { inherit config; };


How do I extend the original default.nix file to include the package I need?

I believe this should work:

pkgs.haskell.packages.ghcjs.callCabal2nix "app" ./. {
  morpheus-graphql-client = pkgs.haskell.packages.ghcjs.callPackage ./morpheus-client.nix {};

Alternatively you could also use pkgs.haskell.packages.ghcjs.callHackage "morpheus-graphql-client" "0.13.0" {}; instead of the callPackage.