-- | Working with @nix develop@
module System.Nix.Flake.Develop (
  inNixShell,
) where

{- | Check if running inside a nix develop shell

This function checks for the IN_NIX_SHELL environment variable,
which is set by @nix develop@.
-}
inNixShell :: (MonadIO m) => m Bool
inNixShell :: forall (m :: Type -> Type). MonadIO m => m Bool
inNixShell = do
  Maybe String -> Bool
forall a. Maybe a -> Bool
isJust (Maybe String -> Bool) -> m (Maybe String) -> m Bool
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> m (Maybe String)
forall (m :: Type -> Type). MonadIO m => String -> m (Maybe String)
lookupEnv String
"IN_NIX_SHELL"