haskell / haskell/cabal

cabal.project ghc-options are not in plan.json

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

Description

**Describe the bug**
It would be useful to have the ghc-options that are specified in a cabal.project file included in the plan.json. We use the plan.json to build nix expressions for building with nix and currently users who specify `ghc-options` for packages in the `cabal.project` file must also specify them in their nix expressions to get the same results. This is in contrast to `flags` specified in the `cabal.project` file which do wind up in the plan.json file.

**To Reproduce**
Add something like this to `cabal.project`

```
package test-ghc-options
ghc-options: -DTEST_GHC_OPTION
```

Run

```
$ cabal v2-configure
```

Observe that the `ghc-options` are not in the `plan.json` generated, though they will be used when `cabal v2-build test-ghc-options` is run.

Example code [here](https://github.com/input-output-hk/haskell.nix/tree/147cf2134100be0b72e14a47ded9a1c8b57d5b57/test/ghc-options) and the nix based work around we currently use is [here](https://github.com/input-output-hk/haskell.nix/blob/147cf2134100be0b72e14a47ded9a1c8b57d5b57/test/ghc-options/cabal.nix#L13).

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue by adding the shown ghc-options entry to cabal.project, running cabal v2-configure, and inspecting the generated plan.json. Compare the result with the existing flags behavior and the test/ghc-options example linked in the report. Done means package ghc-options from cabal.project are represented in plan.json and still match the options used by cabal v2-build.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.