-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{-| | ||
Description : Interact with a local binary Nix store. | ||
Maintainer : Brian McKenna <[email protected]> | ||
-} | ||
module System.Nix.Store.Binary.Local ( | ||
localBinaryStoreEffects | ||
) where | ||
|
||
import Control.Monad.Trans (MonadIO(..)) | ||
import System.Directory | ||
import System.FilePath | ||
import System.Nix.Store.Binary | ||
import qualified Data.ByteString as BS | ||
import qualified Data.Text as T | ||
|
||
localBinaryStoreEffects | ||
:: (MonadIO m) | ||
=> FilePath | ||
-> BinaryStoreEffects m | ||
localBinaryStoreEffects cacheDir = | ||
BinaryStoreEffects upsertFile' | ||
where | ||
upsertFile' pth d _ = liftIO $ do | ||
let pth' = cacheDir </> T.unpack pth | ||
createDirectoryIfMissing True $ takeDirectory pth' | ||
BS.writeFile pth' d |