Haskell Env with CPP env

I have a nix shell script for cpp where i managed to add some python libraries, I would like to the basic haskell environment. so I added my own haskellPkgs to the buildInputs

{pkgs, stdenv, lib, libpqxx, boost, cmake, gtest, static ? false }:
let  
haskellPkgs =  pkgs.haskellPackages.developPackage {
    root = ./.;
    name = "epc";
    modifier = drv:
      pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages;
        [ cabal-install
          ghcid
        ]);
in
  stdenv.mkDerivation {
    name = "pq";
    nativeBuildInputs = [ cmake ];
    buildInputs = with pkgs; [
      haskellPkgs
      gmock ];
      checkInputs = [ gtest ];
      cmakeFlags = [
      (lib.optional static "-DBUILD_STATIC=1")
      (lib.optional (!static) "-DENABLE_TESTS=1")
      ];
      makeTarget = "pq";
    doCheck = true;
    checkTarget = "test";
  }

when I start the shell like this it says

bash: /nix/store/jgfmk61zbzrbbvdk963ibizh84dbyfig-ghc-8.8.4: Is a directory

I tried to add ghc to the haskell packages and to the build input but it didn’t find the executional ether way. I don’t understand why it tries to start the wrong ghc… when I start a shell with just the haskellPkgs it works fine. Perhaps something is wrong with the way I try to import it into the buildInput or I shouldn’t bit it there at all?

my default.nix looks like this

let
  pkgs = import <nixpkgs> {  overlays = [ (import ./overlay.nix) ];};
in pkgs.pq

and my overlay.nix like this

self: super: {
  pq = self.callPackage ./derivation.nix{};
}

Instead of adding haskellPkgs to buildInputs list you probably have to do buildInputs = haskellPkgs.buildInputs ++ (with pkgs; [ ...])

1 Like