@@ -44,7 +44,7 @@ import qualified System.Info
4444import System.Process
4545
4646import qualified System.Nix.Hash as Store
47- import qualified System.Nix.Store.Remote as Store
47+ import qualified System.Nix.Store.Remote as Store.Remote
4848import qualified System.Nix.StorePath as Store
4949
5050-- | A path into the nix store
@@ -227,11 +227,11 @@ instance MonadHttp IO where
227227
228228
229229class Monad m => MonadPutStr m where
230- -- TODO: Should this be used *only* when the Nix to be evaluated invokes a
231- -- `trace` operation?
232- putStr :: String -> m ()
233- default putStr :: (MonadTrans t , MonadPutStr m' , m ~ t m' ) => String -> m ()
234- putStr = lift . putStr
230+ -- TODO: Should this be used *only* when the Nix to be evaluated invokes a
231+ -- `trace` operation?
232+ putStr :: String -> m ()
233+ default putStr :: (MonadTrans t , MonadPutStr m' , m ~ t m' ) => String -> m ()
234+ putStr = lift . putStr
235235
236236putStrLn :: MonadPutStr m => String -> m ()
237237putStrLn = putStr . (<> " \n " )
@@ -251,20 +251,20 @@ type StorePathSet = HS.HashSet StorePath
251251
252252class Monad m => MonadStore m where
253253
254- -- | Copy the contents of a local path to the store. The resulting store
255- -- path is returned. Note: This does not support yet support the expected
256- -- `filter` function that allows excluding some files.
257- addToStore :: StorePathName -> FilePath -> RecursiveFlag -> RepairFlag -> m (Either ErrorCall StorePath )
258- default addToStore :: (MonadTrans t , MonadStore m' , m ~ t m' ) => StorePathName -> FilePath -> RecursiveFlag -> RepairFlag -> m (Either ErrorCall StorePath )
259- addToStore a b c d = lift $ addToStore a b c d
254+ -- | Copy the contents of a local path to the store. The resulting store
255+ -- path is returned. Note: This does not support yet support the expected
256+ -- `filter` function that allows excluding some files.
257+ addToStore :: StorePathName -> FilePath -> RecursiveFlag -> RepairFlag -> m (Either ErrorCall StorePath )
258+ default addToStore :: (MonadTrans t , MonadStore m' , m ~ t m' ) => StorePathName -> FilePath -> RecursiveFlag -> RepairFlag -> m (Either ErrorCall StorePath )
259+ addToStore a b c d = lift $ addToStore a b c d
260260
261- -- | Like addToStore, but the contents written to the output path is a
262- -- regular file containing the given string.
263- addTextToStore' :: StorePathName -> Text -> Store. StorePathSet -> RepairFlag -> m (Either ErrorCall StorePath )
264- default addTextToStore' :: (MonadTrans t , MonadStore m' , m ~ t m' ) => StorePathName -> Text -> Store. StorePathSet -> RepairFlag -> m (Either ErrorCall StorePath )
265- addTextToStore' a b c d = lift $ addTextToStore' a b c d
261+ -- | Like addToStore, but the contents written to the output path is a
262+ -- regular file containing the given string.
263+ addTextToStore' :: StorePathName -> Text -> Store. StorePathSet -> RepairFlag -> m (Either ErrorCall StorePath )
264+ default addTextToStore' :: (MonadTrans t , MonadStore m' , m ~ t m' ) => StorePathName -> Text -> Store. StorePathSet -> RepairFlag -> m (Either ErrorCall StorePath )
265+ addTextToStore' a b c d = lift $ addTextToStore' a b c d
266266
267- parseStoreResult :: Monad m => String -> (Either String a , [Store. Logger ]) -> m (Either ErrorCall a )
267+ parseStoreResult :: Monad m => String -> (Either String a , [Store.Remote. Logger ]) -> m (Either ErrorCall a )
268268parseStoreResult name res = case res of
269269 (Left msg, logs) -> return $ Left $ ErrorCall $ " Failed to execute '" <> name <> " ': " <> msg <> " \n " <> show logs
270270 (Right result, _) -> return $ Right result
@@ -275,13 +275,13 @@ instance MonadStore IO where
275275 Left err -> return $ Left $ ErrorCall $ " String '" <> show name <> " ' is not a valid path name: " <> err
276276 Right pathName -> do
277277 -- TODO: redesign the filter parameter
278- res <- Store. runStore $ Store. addToStore @ 'Store.SHA256 pathName path recursive (const False ) repair
278+ res <- Store.Remote. runStore $ Store.Remote . addToStore @ 'Store.SHA256 pathName path recursive (const False ) repair
279279 parseStoreResult " addToStore" res >>= \ case
280280 Left err -> return $ Left err
281281 Right storePath -> return $ Right $ StorePath $ T. unpack $ T. decodeUtf8 $ Store. storePathToRawFilePath storePath
282282
283283 addTextToStore' name text references repair = do
284- res <- Store. runStore $ Store. addTextToStore name text references repair
284+ res <- Store.Remote. runStore $ Store.Remote . addTextToStore name text references repair
285285 parseStoreResult " addTextToStore" res >>= \ case
286286 Left err -> return $ Left err
287287 Right path -> return $ Right $ StorePath $ T. unpack $ T. decodeUtf8 $ Store. storePathToRawFilePath path
0 commit comments