Skip to content

Commit

Permalink
Merge pull request #190 from haskell-nix/release/remote-0.6
Browse files Browse the repository at this point in the history
Release remote 0.6
  • Loading branch information
sorki authored Jun 6, 2022
2 parents 8e14153 + 4f80b53 commit 74f543f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
7 changes: 7 additions & 0 deletions hnix-store-remote/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
6 changes: 2 additions & 4 deletions hnix-store-remote/hnix-store-remote.cabal
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
21 changes: 8 additions & 13 deletions hnix-store-remote/src/System/Nix/Store/Remote.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
{-# language ScopedTypeVariables #-}
{-# language DataKinds #-}
{-# language RecordWildCards #-}
{-# language LiberalTypeSynonyms #-}

module System.Nix.Store.Remote
( addToStore
, addTextToStore
Expand Down Expand Up @@ -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

Expand All @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions hnix-store-remote/tests/NixDaemon.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 74f543f

Please sign in to comment.