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

Allow nix mode commands to run outside of a project #4885

Merged
merged 1 commit into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Other enhancements:

Bug fixes:

* Allow Stack commands to be run in Nix mode without having a project file
available. See
[#4854](https://github.com/commercialhaskell/stack/issues/4864).


## v2.1.1.1

Expand Down
10 changes: 5 additions & 5 deletions src/Stack/Nix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import Stack.Constants (platformVariantEnvVar,inNixShellEnvVar,inConta
import Stack.Types.Config
import Stack.Types.Docker
import Stack.Types.Nix
import Stack.Docker (getProjectRoot)
import System.Environment (getArgs,getExecutablePath,lookupEnv)
import qualified System.FilePath as F
import RIO.Process (processContextL, exec)
Expand All @@ -43,10 +42,11 @@ runShellAndExit = do
local (set processContextL envOverride) $ do
let cmnd = escape exePath
args' = map escape args
projectRoot <- getProjectRoot
mshellFile <-
traverse (resolveFile projectRoot) $
nixInitFile (configNix config)

mshellFile <- case configProjectRoot config of
Just projectRoot ->
traverse (resolveFile projectRoot) $ nixInitFile (configNix config)
Nothing -> pure Nothing

-- This will never result in double loading the build config, since:
--
Expand Down