File tree Expand file tree Collapse file tree 6 files changed +13
-3
lines changed
src/System/Nix/Store/Remote Expand file tree Collapse file tree 6 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 99 * ` BuildResult ` s ` timesBuild ` field changes type from ` Integer ` to ` Int ` [ #231 ] ( https://github.com/haskell-nix/hnix-store/pull/231 )
1010
1111* Additions:
12+ * ` Default StoreDir ` instance [ #231 ] ( https://github.com/haskell-nix/hnix-store/pull/231 )
1213 * ` System.Nix.StorePath.storePathHashPartToText ` [ #231 ] ( https://github.com/haskell-nix/hnix-store/pull/231 )
1314 * Added ` Generic ` and ` Show ` instances for
1415 ` Signature ` and ` NarSignature ` [ #231 ] ( https://github.com/haskell-nix/hnix-store/pull/231 )
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ library
6060 , case-insensitive
6161 , cereal
6262 , containers
63+ , data-default-class
6364 , generic-arbitrary < 1.1
6465 -- Required for cryptonite low-level type convertion
6566 , memory
@@ -140,6 +141,7 @@ test-suite format-tests
140141 , bytestring
141142 , containers
142143 , cryptonite
144+ , data-default-class
143145 , directory
144146 , filepath
145147 , process
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ module System.Nix.Internal.StorePath
3232 )
3333where
3434
35+ import Data.Default.Class (Default (def ))
3536import qualified Relude.Unsafe as Unsafe
3637import System.Nix.Internal.Hash
3738import System.Nix.Internal.Base
@@ -204,6 +205,9 @@ newtype StoreDir = StoreDir {
204205instance Arbitrary StoreDir where
205206 arbitrary = StoreDir . (" /" <> ) . Bytes.Char8. pack <$> arbitrary
206207
208+ instance Default StoreDir where
209+ def = StoreDir " /nix/store"
210+
207211-- | Render a 'StorePath' as a 'RawFilePath'.
208212storePathToRawFilePath :: StoreDir -> StorePath -> RawFilePath
209213storePathToRawFilePath storeDir StorePath {.. } =
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import System.Nix.Derivation ( parseDerivation
1313 , buildDerivation
1414 )
1515
16+ import Data.Default.Class (Default (def ))
1617import qualified Data.Attoparsec.Text
1718import qualified Data.Text.IO
1819import qualified Data.Text.Lazy
@@ -27,10 +28,10 @@ processDerivation source dest = do
2728 (Data.Text.IO. writeFile dest
2829 . toText
2930 . Data.Text.Lazy.Builder. toLazyText
30- . buildDerivation ( StoreDir " /nix/store " )
31+ . buildDerivation def
3132 )
3233 (Data.Attoparsec.Text. parseOnly
33- (parseDerivation $ StoreDir " /nix/store " )
34+ (parseDerivation def )
3435 contents
3536 )
3637
Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ library
8585 , cereal
8686 , containers
8787 , cryptonite
88+ , data-default-class
8889 , text
8990 , time
9091 , network
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import Control.Monad.Except
2222import Control.Monad.Reader (asks , runReaderT )
2323import Control.Monad.State.Strict
2424
25+ import Data.Default.Class (Default (def ))
2526import qualified Data.Bool
2627import Data.Binary.Get
2728import Data.Binary.Put
@@ -168,7 +169,7 @@ runOpArgsIO op encoder = do
168169 throwError $ Data.ByteString.Char8. unpack msg
169170
170171runStore :: MonadStore a -> IO (Either String a , [Logger ])
171- runStore = runStoreOpts defaultSockPath $ StoreDir " /nix/store "
172+ runStore = runStoreOpts defaultSockPath def
172173
173174runStoreOpts
174175 :: FilePath -> StoreDir -> MonadStore a -> IO (Either String a , [Logger ])
You can’t perform that action at this time.
0 commit comments