Add support for `CABAL_PROJECT_FILE` environment variable
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
The v2 API of Cabal uses `cabal.project` files to specify configuration, but this file currently has to be supplied through the `--project-file` flag.
This is painful as `new-config` doesn't persist this flag so the user has to supply it on each invocation of `new-build`. Environment variables are also easier to set from "virtual environment" providing tools like `nix-shell`.
My specific usecase is having a default `cabal.project` containing `source-repository-package` sections which is used for a normal cabal-resolved build, while at the same time having a second `cabal.project` file in a different folder having no such references since all the package overrides would be handled by Nix (see [note in my haskell nix tutorial](https://github.com/fghibellini/nix-haskell-monorepo/tree/master/shell.nix#cabal-new--commands)).
I am willing to implement it myself (or at least try).
Contributor guide
Research direction
Start by tracing how the --project-file option is handled by the v2 new-config and new-build commands. Check the existing command-line handling and related configuration behavior, then verify that CABAL_PROJECT_FILE can select a cabal.project file for both commands without requiring the flag on each invocation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- build-system, cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100