Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cabal-install 1.24 attempts to create /homeless-shelter/.cabal/config causing builds to break #16144

Closed
stepcut opened this issue Jun 11, 2016 · 6 comments
Labels

Comments

@stepcut
Copy link
Contributor

stepcut commented Jun 11, 2016

Issue description

It appears to me that a number of cabal-install commands in cabal install 1.24 have a side effect of attempting to create ~/.cabal/config which gets expanded to /homeless-shelter/.cabal/config which fails. For example, installing ghcjs fails with

Creating package registration file:
/private/var/folders/_b/wj7ns2190gd3hbz9w0f3m17c0000gn/T/nix-build-ghcjs-0.2.0.drv-0/pkgConf-ghc-prim-0.4.01622650073984943658.0
Config file path source is default config file.
Config file /homeless-shelter/.cabal/config not found.
Writing default configuration to /homeless-shelter/.cabal/config
/homeless-shelter: createDirectory: permission denied (Permission denied)
cabal: Leaving directory './boot/ghc-prim'
Failed to install ghc-prim-0.4.0.0
cabal: Error: some packages failed to install:
ghc-prim-0.4.0.0 failed during the final install step. The exception was:
ExitFailure 1

Steps to reproduce

I am not entirely sure. Many Haskell libraries install just fine. I think the issue only occurs with things like ghcjs which attempt to invoke cabal-install itself.

This is the patch to cabal-install which I believe is responsible:

haskell/cabal@3bb8c7a

In particular, wrapperAction is changed to call loadConfigOrSandbox

haskell/cabal@3bb8c7a#diff-53e6b83dd13dd8fb7781bc0ce3e6b36bL282

and loadConfig is responsible for trying to create ~/.cabal/config.

A second data point is my cabalsdist helper:

https://github.com/stepcut/cabalsdist

Previous I was able to use it in my default.nix to ensure that only files listed in the .cabal file were added to the src .tar.gz

mkDerivation {
  pname = "happstack-server";
  version = "7.4.6.1";
  src = cabalsdist { pathname = ./.; };
  # [snip]

But that also started failing with an error about not being able to create /homeless-shelter/.cabal/config.

I have no suggestions for a fix or a work around at this time.

@peti
Copy link
Member

peti commented Jun 12, 2016

I typically set export HOME=$TMP to work around these kind of issues.

ryantrinkle pushed a commit to ryantrinkle/nixpkgs that referenced this issue Jul 27, 2016
ryantrinkle pushed a commit to ryantrinkle/nixpkgs that referenced this issue Jul 27, 2016
ryantrinkle pushed a commit to ryantrinkle/nixpkgs that referenced this issue Jul 27, 2016
@peti peti added the 0.kind: bug Something is broken label Sep 10, 2016
@peti
Copy link
Member

peti commented Sep 10, 2016

Does this issue still exist?

@chris-martin
Copy link
Contributor

chris-martin commented Sep 17, 2017

The issue still exists: If you write a Nix package that runs cabal build, you're going to have to be aware of it and apply the workaround.

I opened a Cabal issue. If they're not interested in fixing it there, then I think we ought to reopen this as a documentation issue here.

@peti
Copy link
Member

peti commented Sep 17, 2017

Why would anyone call cabal build inside of a Nix build? Just run runhaskell Setup.hs build to achieve the same effect with way less moving parts involved.

@chris-martin
Copy link
Contributor

Because one didn't know you could do that! Either way, documentation issue? 😃

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/testing-haskell-projects-that-use-homeless-shelter-up/7540/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants