@@ -6,6 +6,7 @@ module Obelisk.Command.Project
66 , findProjectObeliskCommand
77 , findProjectRoot
88 , inProjectShell
9+ , inImpureProjectShell
910 ) where
1011
1112import Control.Monad
@@ -152,18 +153,24 @@ isWritableOnlyBy s uid = fileOwner s == uid && fileMode s .&. 0o22 == 0
152153
153154-- | Run a command in the given shell for the current project
154155inProjectShell :: String -> String -> IO ()
155−inProjectShell shellName command = do
156+inProjectShell = inProjectShell' ["--pure"]
157+
158+inProjectShell' :: [String] -> String -> String -> IO ()
159+inProjectShell' args shellName command = do
156160 findProjectRoot "." >>= \case
157161 Nothing -> putStrLn "Must be used inside of an Obelisk project"
158162 Just root -> do
159− (_, _, _, ph) <- createProcess_ "runNixShellAttr" $ setCwd (Just root) $ proc "nix-shell"
160− [ "--pure"
161− , "-A"
163+ (_, _, _, ph) <- createProcess_ "runNixShellAttr" $ setCwd (Just root) $ proc "nix-shell" $
164+ args <>
165+ [ "-A"
162166 , "shells." <> shellName
163167 , "--run", command
164168 ]
165169 _ <- waitForProcess ph
166170 return ()
167171
172+inImpureProjectShell :: String -> String -> IO ()
173+inImpureProjectShell = inProjectShell' []
174+
168175setCwd :: Maybe FilePath -> CreateProcess -> CreateProcess
169176setCwd fp cp = cp { cwd = fp }