cabalcabal-new

How to cleanup nix style cabal if soemthing is out of order?


Remember the old days before we had nix-style cabal. When we got into cabal hell, we could delete the 2 directories .cabal and .ghc and restart with clean cabal environnement.

Now I think, on one of my machines something went wrong and my nix-style v2-cabal repository is out of order.

If I do cabal v2-install --dry-run directory I get:

Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] next goal: directory (user goal)
[__0] rejecting: directory-1.3.4.0 (constraint from user target requires
==1.3.3.2)
[__0] trying: directory-1.3.3.2
[__1] next goal: ghc (user goal)
[__1] rejecting: ghc-8.6.5, ghc-8.6.4 (constraint from user target requires
==8.6.3)
[__1] rejecting: ghc-8.6.3/installed-8.6... (conflict: directory==1.3.3.2, ghc
=> directory==1.3.3.0/installed-1.3...)
[__1] rejecting: ghc-8.6.1, ghc-8.4.4, ghc-8.4.3, ghc-8.4.1, ghc-8.2.2,
ghc-8.2.1 (constraint from user target requires ==8.6.3)
[__1] fail (backjumping, conflict set: directory, ghc)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: directory, ghc

The problem is with GHC-8.6.3.
On another machine, this works fine, therefore I think, something is wrong.

How can I fix this? Is it enough to delete the following directories?

Are there any other directories / files, that I have to delete? Is there something like a cabal v2-clean command?

I don't want to delete the installed packages of other GHC releases, therefore I don't want to delete the .cabal and .ghc directories totally.


Solution

  • Almost certainly the problem is you have a conflicting lib in your global ghc environment file: https://ghc.gitlab.haskell.org/ghc/doc/users_guide/packages.html#package-environments

    You can clean entries out from that file by hand, or manage it with a tool such as https://github.com/phadej/cabal-env