File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
src/System/Nix/Store/Binary Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -15,10 +15,13 @@ cabal-version: >=1.10
1515
1616library
1717 exposed-modules : System.Nix.Store.Binary
18+ , System.Nix.Store.Binary.Local
1819
1920 build-depends : base >= 4.10 && < 4.12
2021 , binary
2122 , bytestring
23+ , directory
24+ , filepath
2225 , lzma
2326 , mtl
2427 , text
Original file line number Diff line number Diff line change 1+ {-|
2+ Description : Interact with a local binary Nix store.
3+ Maintainer : Brian McKenna <[email protected] > 4+ -}
5+ module System.Nix.Store.Binary.Local (
6+ localBinaryStoreEffects
7+ ) where
8+
9+ import Control.Monad.Trans (MonadIO (.. ))
10+ import System.Directory
11+ import System.FilePath
12+ import System.Nix.Store.Binary
13+ import qualified Data.ByteString as BS
14+ import qualified Data.Text as T
15+
16+ localBinaryStoreEffects
17+ :: (MonadIO m )
18+ => FilePath
19+ -> BinaryStoreEffects m
20+ localBinaryStoreEffects cacheDir =
21+ BinaryStoreEffects upsertFile'
22+ where
23+ upsertFile' pth d _ = liftIO $ do
24+ let pth' = cacheDir </> T. unpack pth
25+ createDirectoryIfMissing True $ takeDirectory pth'
26+ BS. writeFile pth' d
You can’t perform that action at this time.
0 commit comments