Fetching and building a Haskell project from github (nix-build succeeds, but nix-shell fails)

I am trying to create a shell.nix for a project which uses various tools. Among the tools needed in the shell is a program written in Haskell (pandoc-theorem), which is available on GitHub (I have my own fork and some patches to it). My understanding is that I need a Nix Expression for this program which uses pkgs.haskellPackages.developPackage along with pkgs.fetchFromGitHub to fetch and build this for the shell. This expression will be put in a file, then the shell.nix file imports this expression and adds it the buildInputs parameter of of mkShell.

I have created the two files, and attempted to nix-shell to test that I get access to the tool. I can build using nix-build, which creates the compiled executable and puts it in the “result” directory. But I wanted to bundle this package together with a whole set for a project using nix-shell.

Unfortunately running nix-shell fails with the error:

bash: /nix/store/wi7b5b1s38py64pyl658v0q8vc0wqdsw-ghc-9.4.8-with-packages: Is a directory

What is the source of this error? I must have misunderstood something about how to build the Haskell project and import into nix-shell, but I don’t really know where to start unwinding this. I have included the details below. In advance, thanks for any pointers in the right direction.



{ pkgs ? import <nixpkgs> {} } :
  pandocTheoremSrc = pkgs.fetchFromGitHub {
    owner = "typeterrorist";
    repo = "pandoc-theorem";
    rev = "d2fc223f";
    sha256 = "sha256-rvS+pZro3KkFgdgBxKkVDeJJa8WW2zk59ExooIAb7C0=";
 pkgs.haskellPackages.developPackage {
  name = "pandoc-theorem";
  root = pandocTheoremSrc;
  modifier = drv:
      pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages;
        [ cabal-install


{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {
  buildInputs = [
    (import ./pandoc-theorem.nix { inherit pkgs; })

Attempting to run nix-shell in the directory with shell.nix and pandoc-theorem.nix in it:

$ nix-shell
building '/nix/store/xf8ra4snjar5hnl45awa6kx7ljmvg276-ghc-shell-for-pandoc-theorem-0.2.0.drv'...
Running phase: installPhase
bash: /nix/store/wi7b5b1s38py64pyl658v0q8vc0wqdsw-ghc-9.4.8-with-packages: Is a directory
bash: pop_var_context: head of «shell_variables» is not a function context
bash: pop_var_context: head of «shell_variables» is not a function context

(As far as I can understand the “is not a function context” lines are not important part, since they stem from a bash bug when there is a build error. It is the build error “Is a directory” which is the problem.)