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

Stack clean does not work correctly with --nix #3468

Closed
ElvishJerricco opened this issue Oct 3, 2017 · 6 comments
Closed

Stack clean does not work correctly with --nix #3468

ElvishJerricco opened this issue Oct 3, 2017 · 6 comments

Comments

@ElvishJerricco
Copy link

ElvishJerricco commented Oct 3, 2017

When using nix integration, stack clean does not work. I'm not sure if there's any reason it should need GHC at all for clean, but it exits with a No compiler found, ... error message when the user does not have GHC installed in their user profile. Presumably Stack is not performing clean from within the nix shell, or it should not need GHC at all.

EDIT: This is a regression in Stack 1.5. This worked in 1.4.

@mgsloan
Copy link
Contributor

mgsloan commented Oct 4, 2017

That is just part of stack's normal environment setup. There isn't currently an environment type / code to load it that reflects "I need to use Cabal but I don't need GHC". Main commit relevant to this - cfb445 - I suppose that might have regressed nix support. Possibly changes to defaulting to not using system ghc, though IIRC it will default to that for nix. I don't use nix much, from some poor experiences with it I tend to avoid it. Granted, I haven't put in more than just a couple dozen hours trying to wrangle it.

stack clean is implemented by running Cabal clean (roughly kinda like runghc Setup.hs clean), so this does require GHC.

stack clean --full could potentially be implemented to not need the compiler, since it just recursively deletes the work dirs.

Leaning towards wontfix, I don't see why this matters. Why would you ever want to clean if you don't have a compiler? Would accept a PR that makes loading the full env unnecessary for stack clean --full.

@mgsloan mgsloan added this to the P3: Optional milestone Oct 4, 2017
@ElvishJerricco
Copy link
Author

@mgsloan the regression is that Stack should enter the Nix shell when doing clean with —nix, like it does for every other command. Entering the Nix shell would provide it with the GHC it needs. Excuse my irrelevant commentary on whether GHC should be necessary for clean at all =P

@mgsloan
Copy link
Contributor

mgsloan commented Oct 4, 2017

Updated the first paragraph of my comment above. I think the commit linked there is definitely the cause of the issue. A couple possible solutions:

  • Have stack clean enter nix shell, but not docker containers. Problem with this approach is it won't work for docker + nix.
  • Have stack clean --full not enter either nix or docker containers. stack clean would enter both, which is an enhancement, current code path demands you have cabal / ghc outside of your docker / nix. Can also maybe make stack clean --full skip demanding a ghc / cabal be installed.

I'll give it a shot.

@mgsloan
Copy link
Contributor

mgsloan commented Oct 4, 2017

I've split off #3469 and opened #3470 . Can you please check if that change fixes the issue? Thanks! The solution is not ideal: #3471

@ElvishJerricco
Copy link
Author

That appears to have fixed it. Thanks!

mgsloan added a commit that referenced this issue Oct 4, 2017
@mgsloan
Copy link
Contributor

mgsloan commented Oct 4, 2017

Great, merged! Thanks for confirming

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

No branches or pull requests

2 participants