Skip to content

Commit

Permalink
Nix: Pass $STACK_IN_NIX_EXTRA_ARGS before command args. commercialhas…
Browse files Browse the repository at this point in the history
  • Loading branch information
luigy committed Dec 18, 2015
1 parent 0708ee4 commit e21472f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Stack/Nix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module Stack.Nix
) where

import Control.Applicative
import Control.Arrow ((***))
import Control.Monad
import Control.Monad.Catch (try,MonadCatch)
import Control.Monad.IO.Class (MonadIO,liftIO)
Expand Down Expand Up @@ -64,7 +65,7 @@ runShellAndExit :: M env m
runShellAndExit getCmdArgs = do
config <- asks getConfig
envOverride <- getEnvOverride (configPlatform config)
(cmnd,args) <- getCmdArgs
(cmnd,args) <- fmap (escape *** map escape) getCmdArgs
let mshellFile = nixInitFile (configNix config)
pkgsInConfig = nixPackages (configNix config)
pureShell = nixPureShell (configNix config)
Expand All @@ -86,9 +87,9 @@ runShellAndExit getCmdArgs = do
fullArgs = concat [if pureShell then ["--pure"] else [],
map T.unpack (nixShellOptions (configNix config))
,nixopts
,["--command", intercalate " " (map escape (cmnd:args))
++ " $STACK_IN_NIX_EXTRA_ARGS"]
,["--command", intercalate " " (cmnd:"$STACK_IN_NIX_EXTRA_ARGS":args)]
]

$logDebug $
"Using a nix-shell environment " <> (case mshellFile of
Just filePath -> "from file: " <> (T.pack filePath)
Expand Down

0 comments on commit e21472f

Please sign in to comment.