@@ -44,7 +44,7 @@ import qualified System.Info
44
44
import System.Process
45
45
46
46
import 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
48
48
import qualified System.Nix.StorePath as Store
49
49
50
50
-- | A path into the nix store
@@ -227,11 +227,11 @@ instance MonadHttp IO where
227
227
228
228
229
229
class 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
235
235
236
236
putStrLn :: MonadPutStr m => String -> m ()
237
237
putStrLn = putStr . (<> " \n " )
@@ -251,20 +251,20 @@ type StorePathSet = HS.HashSet StorePath
251
251
252
252
class Monad m => MonadStore m where
253
253
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
260
260
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
266
266
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 )
268
268
parseStoreResult name res = case res of
269
269
(Left msg, logs) -> return $ Left $ ErrorCall $ " Failed to execute '" <> name <> " ': " <> msg <> " \n " <> show logs
270
270
(Right result, _) -> return $ Right result
@@ -275,13 +275,13 @@ instance MonadStore IO where
275
275
Left err -> return $ Left $ ErrorCall $ " String '" <> show name <> " ' is not a valid path name: " <> err
276
276
Right pathName -> do
277
277
-- 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
279
279
parseStoreResult " addToStore" res >>= \ case
280
280
Left err -> return $ Left err
281
281
Right storePath -> return $ Right $ StorePath $ T. unpack $ T. decodeUtf8 $ Store. storePathToRawFilePath storePath
282
282
283
283
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
285
285
parseStoreResult " addTextToStore" res >>= \ case
286
286
Left err -> return $ Left err
287
287
Right path -> return $ Right $ StorePath $ T. unpack $ T. decodeUtf8 $ Store. storePathToRawFilePath path
0 commit comments