Skip to content

Cabal doesn't work when $HOME is not writable #4770

@chris-martin

Description

@chris-martin

If you ever try to write a Nix package that runs cabal build, you run into this issue:

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions