Skip to content

Commit

Permalink
Merge pull request #4885 from qrilka/nix-mode-without-project
Browse files Browse the repository at this point in the history
Allow nix mode commands to run outside of a project
  • Loading branch information
snoyberg authored Jun 19, 2019
2 parents 22fe3b9 + 8ab9995 commit e791b00
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Bug fixes:
* Fix to allow dependencies on specific versions of local git repositories. See
[#4862](https://github.com/commercialhaskell/stack/pull/4862)

* 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

0 comments on commit e791b00

Please sign in to comment.