Simple haskell setup

I Am trying to get a simple haskell setup with the defalt.nix:

  pkgs = import <nixpkgs> { };
  pkgs.haskellPackages.developPackage {
    root = ./.;
    modifier = drv:
      pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages;
        [ cabal-install

when I start the shell I get this output

building '/nix/store/64lj39759am0v4c67pblb4srndlr5wff-cabal2nix-nixosTest.drv'...
cabal2nix: nix-prefetch-url: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
builder for '/nix/store/64lj39759am0v4c67pblb4srndlr5wff-cabal2nix-nixosTest.drv' failed with exit code 1
error: build of '/nix/store/64lj39759am0v4c67pblb4srndlr5wff-cabal2nix-nixosTest.drv' failed

cabal2nix is installed as a package in the configuration.nix of my system. I had other Problems after a garbage collection, many programs didn’t find their default programs like their default browser etc. because the hash had changed. How can I restore or remap the libraries of packages after a garbage. collection

This is quite common issue and the error message is by far from ideal.

What’s probably happening is that developPackage can’t figure out the name of your cabal file.

Reading the source of developPackage there’s name ? builtins.baseNameOf root so if you don’t pass name to developPackage it will try to guess it and use the name of root dir instead. You can either set name to match your package name (dir should have ${name}.cabal available) or rename your root dir so it matches package name.


I’ve opened to try to remedy this.