mirror of
https://github.com/haskell-nix/hnix-store.git
synced 2024-12-14 19:47:56 +03:00
Merge pull request #190 from haskell-nix/release/remote-0.6
Release remote 0.6
This commit is contained in:
commit
74f543f775
@ -1,5 +1,12 @@
|
||||
# Revision history for hnix-store-remote
|
||||
|
||||
## [0.6.0.0](https://github.com/haskell-nix/hnix-store/compare/0.5.0.0...0.6.0.0) 2021-06-06
|
||||
|
||||
* Breaking:
|
||||
* [(link)](https://github.com/haskell-nix/hnix-store/pull/179) `System.Nix.Store.Remote`:
|
||||
* `addToStore` no longer accepts `FilePath` as its second argument but uses
|
||||
more generic `NarSource` [(NarSource PR)](https://github.com/haskell-nix/hnix-store/pull/177)
|
||||
|
||||
## [0.5.0.0](https://github.com/haskell-nix/hnix-store/compare/0.4.3.0...0.5.0.0) 2021-06-11
|
||||
|
||||
* Breaking:
|
||||
|
@ -1,6 +1,6 @@
|
||||
cabal-version: 2.2
|
||||
name: hnix-store-remote
|
||||
version: 0.5.0.0
|
||||
version: 0.6.0.0
|
||||
synopsis: Remote hnix store
|
||||
description: Implementation of the nix store using the daemon protocol.
|
||||
homepage: https://github.com/haskell-nix/hnix-store
|
||||
@ -52,7 +52,7 @@ library
|
||||
, nix-derivation >= 1.1.1 && <2
|
||||
, mtl
|
||||
, unordered-containers
|
||||
, hnix-store-core >= 0.5 && <0.6
|
||||
, hnix-store-core >= 0.6 && <0.7
|
||||
mixins:
|
||||
base hiding (Prelude)
|
||||
, relude (Relude as Prelude)
|
||||
@ -114,10 +114,8 @@ test-suite hnix-store-remote-tests
|
||||
, tasty-quickcheck
|
||||
, linux-namespaces
|
||||
, temporary
|
||||
, text
|
||||
, unix
|
||||
, unordered-containers
|
||||
, vector
|
||||
mixins:
|
||||
base hiding (Prelude)
|
||||
, relude (Relude as Prelude)
|
||||
|
@ -4,6 +4,8 @@
|
||||
{-# language ScopedTypeVariables #-}
|
||||
{-# language DataKinds #-}
|
||||
{-# language RecordWildCards #-}
|
||||
{-# language LiberalTypeSynonyms #-}
|
||||
|
||||
module System.Nix.Store.Remote
|
||||
( addToStore
|
||||
, addTextToStore
|
||||
@ -59,7 +61,6 @@ import qualified Data.Binary.Put
|
||||
import qualified Data.Map.Strict
|
||||
import qualified Data.Set
|
||||
|
||||
import qualified System.Nix.Nar
|
||||
import qualified System.Nix.StorePath
|
||||
import qualified System.Nix.Store.Remote.Parsers
|
||||
|
||||
@ -68,35 +69,29 @@ import System.Nix.Store.Remote.Types
|
||||
import System.Nix.Store.Remote.Protocol
|
||||
import System.Nix.Store.Remote.Util
|
||||
import Crypto.Hash ( SHA256 )
|
||||
import System.Nix.Nar ( NarSource )
|
||||
|
||||
type RepairFlag = Bool
|
||||
type CheckFlag = Bool
|
||||
type SubstituteFlag = Bool
|
||||
|
||||
-- | Pack `FilePath` as `Nar` and add it to the store.
|
||||
-- | Pack `Nar` and add it to the store.
|
||||
addToStore
|
||||
:: forall a
|
||||
. NamedAlgo a
|
||||
. (NamedAlgo a)
|
||||
=> StorePathName -- ^ Name part of the newly created `StorePath`
|
||||
-> FilePath -- ^ Local `FilePath` to add
|
||||
-> NarSource MonadStore -- ^ provide nar stream
|
||||
-> Bool -- ^ Add target directory recursively
|
||||
-> (FilePath -> Bool) -- ^ Path filter function
|
||||
-> RepairFlag -- ^ Only used by local store backend
|
||||
-> MonadStore StorePath
|
||||
addToStore name pth recursive _pathFilter _repair = do
|
||||
|
||||
addToStore name source recursive _repair = do
|
||||
runOpArgsIO AddToStore $ \yield -> do
|
||||
yield $ toStrict $ Data.Binary.Put.runPut $ do
|
||||
putText $ System.Nix.StorePath.unStorePathName name
|
||||
|
||||
putBool $ not $ System.Nix.Hash.algoName @a == "sha256" && recursive
|
||||
|
||||
putBool recursive
|
||||
|
||||
putText $ System.Nix.Hash.algoName @a
|
||||
|
||||
System.Nix.Nar.streamNarIO yield System.Nix.Nar.narEffectsIO pth
|
||||
|
||||
source yield
|
||||
sockGetPath
|
||||
|
||||
-- | Add text to store.
|
||||
|
@ -27,8 +27,8 @@ import System.Nix.StorePath
|
||||
import System.Nix.Store.Remote
|
||||
import System.Nix.Store.Remote.Protocol
|
||||
|
||||
import Crypto.Hash ( SHA256
|
||||
)
|
||||
import Crypto.Hash ( SHA256 )
|
||||
import System.Nix.Nar ( dumpPath )
|
||||
|
||||
createProcessEnv :: FilePath -> String -> [String] -> IO P.ProcessHandle
|
||||
createProcessEnv fp proc args = do
|
||||
@ -159,7 +159,7 @@ withPath action = do
|
||||
dummy :: MonadStore StorePath
|
||||
dummy = do
|
||||
let Right n = makeStorePathName "dummy"
|
||||
addToStore @SHA256 n "dummy" False (pure True) False
|
||||
addToStore @SHA256 n (dumpPath "dummy") False False
|
||||
|
||||
invalidPath :: StorePath
|
||||
invalidPath =
|
||||
@ -250,7 +250,7 @@ spec_protocol = Hspec.around withNixDaemon $
|
||||
itRights "adds file to store" $ do
|
||||
fp <- liftIO $ writeSystemTempFile "addition" "lal"
|
||||
let Right n = makeStorePathName "tmp-addition"
|
||||
res <- addToStore @SHA256 n fp False (pure True) False
|
||||
res <- addToStore @SHA256 n (dumpPath fp) False False
|
||||
liftIO $ print res
|
||||
|
||||
context "with dummy" $ do
|
||||
|
Loading…
Reference in New Issue
Block a user