on master help sign in
Fix project shells
8089f87Alexandre Esteves
lib/command/src/Obelisk/Command/Project.hs+4
@@ -12,6 +12,7 @@ module Obelisk.Command.Project
12 , initProject
12 , initProject
13 , nixShellRunConfig
13 , nixShellRunConfig
14 , nixShellRunProc
14 , nixShellRunProc
15+ , obShellRunProc
15 , nixShellWithHoogle
16 , nixShellWithHoogle
16 , nixShellWithoutPkgs
17 , nixShellWithoutPkgs
17 , obeliskDirName
18 , obeliskDirName
@@ -317,6 +318,9 @@ bashEscape = BSU.toString . bytes . bash . BSU.fromString
317nixShellRunProc :: NixShellConfig -> ProcessSpec
318nixShellRunProc :: NixShellConfig -> ProcessSpec
318nixShellRunProc cfg = setDelegateCtlc True $ proc nixShellPath $ runNixShellConfig cfg
319nixShellRunProc cfg = setDelegateCtlc True $ proc nixShellPath $ runNixShellConfig cfg
319
320
321+obShellRunProc :: FilePath -> Text -> ProcessSpec
322+obShellRunProc root cmd = setDelegateCtlc True $ setCwd (Just root) $ proc "ob" ["shell", T.unpack cmd]
323+
320nixShellWithoutPkgs
324nixShellWithoutPkgs
321 :: MonadObelisk m
325 :: MonadObelisk m
322 => FilePath -- ^ Path to project root
326 => FilePath -- ^ Path to project root
lib/command/src/Obelisk/Command/Run.hs+3−4
@@ -523,13 +523,12 @@ loadPackageIndex root = do
523 liftIO $ getInstalledPackages Verbosity.silent compiler [GlobalPackageDB] programDb
523 liftIO $ getInstalledPackages Verbosity.silent compiler [GlobalPackageDB] programDb
524 where
524 where
525 getPathInNixEnvironment cmd = do
525 getPathInNixEnvironment cmd = do
526− procSpec <- runProc <$> nixShellRunConfig root True (Just cmd)
527− (_,Just h,_,_) <- createProcess_ "loadPackageIndex" procSpec
526+ (_,Just h,_,_) <- createProcess_ "loadPackageIndex" $ procSpec cmd
528 path <- liftIO $ hGetLine h >>= canonicalizePath
527 path <- liftIO $ hGetLine h >>= canonicalizePath
529 liftIO $ hClose h
528 liftIO $ hClose h
530 pure path
529 pure path
531− runProc =
530+ procSpec =
532− overCreateProcess (\cs -> cs { std_out = CreatePipe }) . nixShellRunProc
531+ overCreateProcess (\cs -> cs { std_out = CreatePipe }) . obShellRunProc root
533
532
534baseGhciOptions :: [String]
533baseGhciOptions :: [String]
535baseGhciOptions =
534baseGhciOptions =