module IHP.LibDir (findLibDirectory) where
import IHP.Prelude
import qualified IHP.EnvVar as EnvVar
findLibDirectory :: IO Text
findLibDirectory :: IO Text
findLibDirectory = do
Maybe Text
ihpLibVar <- ByteString -> IO (Maybe Text)
forall (monad :: * -> *) result.
(MonadIO monad, EnvVarReader result) =>
ByteString -> monad (Maybe result)
EnvVar.envOrNothing ByteString
"IHP_LIB"
case Maybe Text
ihpLibVar of
Just Text
ihpLib -> Text -> IO Text
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Text
ihpLib Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"/")
Maybe Text
Nothing -> Text -> IO Text
forall a. Text -> a
error Text
"IHP_LIB env var is not set. Please run 'nix develop --impure' before running the dev server, or make sure that your direnv integration is working correctly."