haskell / haskell/cabal

Cabal doesn't work when $HOME is not writable

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

Description

If you ever try to write a Nix package that runs `cabal build`, you run into [this issue](https://github.com/NixOS/nixpkgs/issues/16144):

Config file /homeless-shelter/.cabal/config not found.
Writing default configuration to /homeless-shelter/.cabal/config
/homeless-shelter: createDirectory: permission denied (Permission denied)

This is because in the context of a Nix build, you don't have a home directory (and, I believe, Nix sets the `HOME` variable to `/homeless-shelter`, which is not a real location, just to be cute).

This isn't a *huge* problem - you can work around it by running `HOME=$TMP cabal build` instead to use the temporary directory as your home directory - but this seems like an unnecessary complication and I'm wondering if we could avoid it altogether.

Does Cabal actually *need* to write to `$HOME/.cabal`? Could it skip whatever it's trying to do there and just build the package?

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.