Skip to content

Commit 25dcf07

Browse files
authored
Merge pull request #3470 from commercialhaskell/fix-nix-stack-clean
Fix "stack clean" with --nix #3468
2 parents b076f2c + 741fd5c commit 25dcf07

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ Bug fixes:
138138
* docs.haskellstack.org RTD documentation search is replaced by the mkdocs
139139
search. Please see
140140
[#3376](https://github.com/commercialhaskell/stack/issues/3376).
141+
* `stack clean` now works with nix. See
142+
[#3468](https://github.com/commercialhaskell/stack/issues/3376).
141143

142144

143145
## 1.5.1

src/Stack/Runners.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ withBuildConfigAndLock
128128
withBuildConfigAndLock go inner =
129129
withBuildConfigExt False go Nothing inner Nothing
130130

131+
-- | See issue #2010 for why this exists. Currently just used for the
132+
-- specific case of "stack clean --full".
131133
withBuildConfigAndLockNoDocker
132134
:: GlobalOpts
133135
-> (Maybe FileLock -> RIO EnvConfig ())
@@ -177,7 +179,7 @@ withBuildConfigExt skipDocker go@GlobalOpts{..} mbefore inner mafter = loadConfi
177179
if skipDocker
178180
then runRIO (lcConfig lc) $ do
179181
forM_ mbefore id
180-
liftIO $ inner'' lk0
182+
Nix.reexecWithOptionalShell (lcProjectRoot lc) getCompilerVersion (inner'' lk0)
181183
forM_ mafter id
182184
else runRIO (lcConfig lc) $
183185
Docker.reexecWithOptionalContainer

src/main/Main.hs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import Path
5151
import Path.IO
5252
import qualified Paths_stack as Meta
5353
import Stack.Build
54-
import Stack.Clean (CleanOpts, clean)
54+
import Stack.Clean (CleanOpts(..), clean)
5555
import Stack.Config
5656
import Stack.ConfigCmd as ConfigCmd
5757
import Stack.Constants
@@ -581,7 +581,12 @@ setupCmd sco@SetupCmdOpts{..} go@GlobalOpts{..} = loadConfigWithOpts go $ \lc ->
581581
(Just $ munlockFile lk)
582582

583583
cleanCmd :: CleanOpts -> GlobalOpts -> IO ()
584-
cleanCmd opts go = withBuildConfigAndLockNoDocker go (const (clean opts))
584+
cleanCmd opts go =
585+
-- See issues #2010 and #3468 for why "stack clean --full" is not used
586+
-- within docker.
587+
case opts of
588+
CleanFull{} -> withBuildConfigAndLock go (const (clean opts))
589+
CleanShallow{} -> withBuildConfigAndLockNoDocker go (const (clean opts))
585590

586591
-- | Helper for build and install commands
587592
buildCmd :: BuildOptsCLI -> GlobalOpts -> IO ()

0 commit comments

Comments
 (0)