module System.Nix.Nar
(
buildNarIO
, unpackNarIO
, Nar.parseNar
, Nar.testParser
, Nar.testParser'
, Nar.NarEffects(..)
, Nar.narEffectsIO
, Nar.NarOptions(..)
, Nar.defaultNarOptions
, Nar.streamNarIO
, Nar.streamNarIOWithOptions
, Nar.runParser
, Nar.runParserWithOptions
, Nar.dumpString
, Nar.dumpPath
, Nar.NarSource
) where
import qualified Control.Concurrent as Concurrent
import qualified Data.ByteString as BS
import qualified System.IO as IO
import qualified System.Nix.Nar.Effects as Nar
import qualified System.Nix.Nar.Options as Nar
import qualified System.Nix.Nar.Parser as Nar
import qualified System.Nix.Nar.Streamer as Nar
buildNarIO
:: Nar.NarEffects IO
-> FilePath
-> IO.Handle
-> IO ()
buildNarIO :: NarEffects IO -> FilePath -> Handle -> IO ()
buildNarIO NarEffects IO
effs FilePath
basePath Handle
outHandle =
NarEffects IO -> FilePath -> NarSource IO
forall (m :: * -> *).
MonadIO m =>
NarEffects IO -> FilePath -> NarSource m
Nar.streamNarIO
NarEffects IO
effs
FilePath
basePath
(\ByteString
chunk -> Handle -> ByteString -> IO ()
BS.hPut Handle
outHandle ByteString
chunk IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Int -> IO ()
Concurrent.threadDelay Int
10)
unpackNarIO
:: Nar.NarEffects IO
-> IO.Handle
-> FilePath
-> IO (Either String ())
unpackNarIO :: NarEffects IO -> Handle -> FilePath -> IO (Either FilePath ())
unpackNarIO NarEffects IO
effs = NarEffects IO
-> NarParser IO () -> Handle -> FilePath -> IO (Either FilePath ())
forall (m :: * -> *) a.
(MonadIO m, MonadBaseControl IO m) =>
NarEffects m
-> NarParser m a -> Handle -> FilePath -> m (Either FilePath a)
Nar.runParser NarEffects IO
effs NarParser IO ()
forall (m :: * -> *). (MonadIO m, MonadFail m) => NarParser m ()
Nar.parseNar