haskell / haskell/cabal

Mysterious user goal dependency added

Open
#7,356 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

On NixOS, running `cabal build` tries to resolve a mysterious dependency (`user goal`) from a previous project.

**To Reproduce**

(with probably a local state somewhere : not ~/.{ghc,cabal,ghci}

```
mkdir new-project
cd new-project
cabal init
cabal build
```

I get

```
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: B-0.0.0 (user goal)
[__1] unknown package: p1 (dependency of B)
[__1] fail (backjumping, conflict set: B, p1)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: B, p1
```

B and p1 are previous [package/libraries that I built successfully in another multi-project](https://github.com/haskell/haskell-language-server/issues/799)

**Expected behavior**
I do not expect B and p1 here, since they are not in the current project dependencies.

**System information**
- NixOS
- `cabal version 3.4.0.0`, `ghc ersion 8.8.4`

------

FIX:

Adding a `cabal.project` file with

```
optional-packages:
*
write-ghc-environment-files: never
```

Fixes the issue. The issue may thus be caused by ghc-environment-files written by `cabal run`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.