Skip to content

Commit 74f543f

Browse files
authored
Merge pull request #190 from haskell-nix/release/remote-0.6
Release remote 0.6
2 parents 8e14153 + 4f80b53 commit 74f543f

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

hnix-store-remote/ChangeLog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Revision history for hnix-store-remote
22

3+
## [0.6.0.0](https://github.com/haskell-nix/hnix-store/compare/0.5.0.0...0.6.0.0) 2021-06-06
4+
5+
* Breaking:
6+
* [(link)](https://github.com/haskell-nix/hnix-store/pull/179) `System.Nix.Store.Remote`:
7+
* `addToStore` no longer accepts `FilePath` as its second argument but uses
8+
more generic `NarSource` [(NarSource PR)](https://github.com/haskell-nix/hnix-store/pull/177)
9+
310
## [0.5.0.0](https://github.com/haskell-nix/hnix-store/compare/0.4.3.0...0.5.0.0) 2021-06-11
411

512
* Breaking:

hnix-store-remote/hnix-store-remote.cabal

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.2
22
name: hnix-store-remote
3-
version: 0.5.0.0
3+
version: 0.6.0.0
44
synopsis: Remote hnix store
55
description: Implementation of the nix store using the daemon protocol.
66
homepage: https://github.com/haskell-nix/hnix-store
@@ -52,7 +52,7 @@ library
5252
, nix-derivation >= 1.1.1 && <2
5353
, mtl
5454
, unordered-containers
55-
, hnix-store-core >= 0.5 && <0.6
55+
, hnix-store-core >= 0.6 && <0.7
5656
mixins:
5757
base hiding (Prelude)
5858
, relude (Relude as Prelude)
@@ -114,10 +114,8 @@ test-suite hnix-store-remote-tests
114114
, tasty-quickcheck
115115
, linux-namespaces
116116
, temporary
117-
, text
118117
, unix
119118
, unordered-containers
120-
, vector
121119
mixins:
122120
base hiding (Prelude)
123121
, relude (Relude as Prelude)

hnix-store-remote/src/System/Nix/Store/Remote.hs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
{-# language ScopedTypeVariables #-}
55
{-# language DataKinds #-}
66
{-# language RecordWildCards #-}
7+
{-# language LiberalTypeSynonyms #-}
8+
79
module System.Nix.Store.Remote
810
( addToStore
911
, addTextToStore
@@ -59,7 +61,6 @@ import qualified Data.Binary.Put
5961
import qualified Data.Map.Strict
6062
import qualified Data.Set
6163

62-
import qualified System.Nix.Nar
6364
import qualified System.Nix.StorePath
6465
import qualified System.Nix.Store.Remote.Parsers
6566

@@ -68,35 +69,29 @@ import System.Nix.Store.Remote.Types
6869
import System.Nix.Store.Remote.Protocol
6970
import System.Nix.Store.Remote.Util
7071
import Crypto.Hash ( SHA256 )
72+
import System.Nix.Nar ( NarSource )
7173

7274
type RepairFlag = Bool
7375
type CheckFlag = Bool
7476
type SubstituteFlag = Bool
7577

76-
-- | Pack `FilePath` as `Nar` and add it to the store.
78+
-- | Pack `Nar` and add it to the store.
7779
addToStore
7880
:: forall a
79-
. NamedAlgo a
81+
. (NamedAlgo a)
8082
=> StorePathName -- ^ Name part of the newly created `StorePath`
81-
-> FilePath -- ^ Local `FilePath` to add
83+
-> NarSource MonadStore -- ^ provide nar stream
8284
-> Bool -- ^ Add target directory recursively
83-
-> (FilePath -> Bool) -- ^ Path filter function
8485
-> RepairFlag -- ^ Only used by local store backend
8586
-> MonadStore StorePath
86-
addToStore name pth recursive _pathFilter _repair = do
87-
87+
addToStore name source recursive _repair = do
8888
runOpArgsIO AddToStore $ \yield -> do
8989
yield $ toStrict $ Data.Binary.Put.runPut $ do
9090
putText $ System.Nix.StorePath.unStorePathName name
91-
9291
putBool $ not $ System.Nix.Hash.algoName @a == "sha256" && recursive
93-
9492
putBool recursive
95-
9693
putText $ System.Nix.Hash.algoName @a
97-
98-
System.Nix.Nar.streamNarIO yield System.Nix.Nar.narEffectsIO pth
99-
94+
source yield
10095
sockGetPath
10196

10297
-- | Add text to store.

hnix-store-remote/tests/NixDaemon.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import System.Nix.StorePath
2727
import System.Nix.Store.Remote
2828
import System.Nix.Store.Remote.Protocol
2929

30-
import Crypto.Hash ( SHA256
31-
)
30+
import Crypto.Hash ( SHA256 )
31+
import System.Nix.Nar ( dumpPath )
3232

3333
createProcessEnv :: FilePath -> String -> [String] -> IO P.ProcessHandle
3434
createProcessEnv fp proc args = do
@@ -159,7 +159,7 @@ withPath action = do
159159
dummy :: MonadStore StorePath
160160
dummy = do
161161
let Right n = makeStorePathName "dummy"
162-
addToStore @SHA256 n "dummy" False (pure True) False
162+
addToStore @SHA256 n (dumpPath "dummy") False False
163163

164164
invalidPath :: StorePath
165165
invalidPath =
@@ -250,7 +250,7 @@ spec_protocol = Hspec.around withNixDaemon $
250250
itRights "adds file to store" $ do
251251
fp <- liftIO $ writeSystemTempFile "addition" "lal"
252252
let Right n = makeStorePathName "tmp-addition"
253-
res <- addToStore @SHA256 n fp False (pure True) False
253+
res <- addToStore @SHA256 n (dumpPath fp) False False
254254
liftIO $ print res
255255

256256
context "with dummy" $ do

0 commit comments

Comments
 (0)