Nix shell + cabal

Hello :wave:

I want to start playing around with haskell, so I wrote a shell for a simple package.

Reading previous posts (Super-Simple Haskell Development with Nix), I bootstrapped a new project and used haskellPackages.developPackage. Because nix develop with this package doesn’t contain cabal, I also created a shell with just cabal and stacked the two shells (nix develop .#myShell and then nix develop .#myPkg) (loaded with direnv).

The problem I see is that when running cabal build, cabal will try to fetch the package index from the internet, and resolve the versions on its own. While the ideal case would be to resolve to the same haskell libs present on the nixpkgs commit I am using.

So is there any way for cabal to get the dependencies from nix itself, or at least resolve to the same versions in nixpkgs?

I’ve put the code here: GitHub - viperML/cabal-nix-question