haskell / haskell/cabal

Add `--cabal-dir` option to `cabal user-config init`

Open
#7,682 0 comments 2 reactions 0 assignees View on GitHub
attention: pr-welcome cabal-install: cmd/user-config type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

* As commented here https://github.com/haskell/cabal/issues/7455#issuecomment-867383415
* This way you can create full isolated cabal config root without using `$CABAL_DIR`

```
D:\ws\haskell\issues\try-dunai2>set CABAL_DIR=D:\ws\haskell\issues\try-dunai2

D:\ws\haskell\issues\try-dunai2>cabal user-config init
Writing default configuration to D:\ws\haskell\issues\try-dunai2\config
D:\ws\haskell\issues\try-dunai2>type .\config
.....
remote-repo-cache: D:\ws\haskell\issues\try-dunai2\packages
-- logs-dir: D:\ws\haskell\issues\try-dunai2\logs
world-file: D:\ws\haskell\issues\try-dunai2\world
....
extra-prog-path: D:\ws\haskell\issues\try-dunai2\bin
...
build-summary: D:\ws\haskell\issues\try-dunai2\logs\build.log
....
installdir: D:\ws\haskell\issues\try-dunai2\bin
.....
etc
```

* after that you can do a fully isolated cabal build which hopefully will not touch any file in `$HOME`

```
D:\ws\haskell\issues\try-dunai2>cabal --config-file=.\config update
Downloading the latest package list from hackage.haskell.org
Updated package list of hackage.haskell.org to the index-state 2021-09-23T05:14:
06Z
D:\ws\haskell\issues\try-dunai2>dir /B
config
log
packages
store

D:\ws\haskell\issues\try-dunai2>cabal --config-file=.\config repl --build-depends=dunai
Resolving dependencies...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
- base-orphans-0.8.5 (lib) (requires download & build)
```

This way we could help recover a specific behaviour from the deprecated sandboxes

//cc @ivanperez-keera

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.