@@ -13,6 +13,7 @@ import Crypto.Hash (Context, Digest, SHA256)
1313import Data.ByteString (ByteString )
1414import Data.HashSet (HashSet )
1515import System.Nix.Hash (BaseEncoding (Base16 ), NamedAlgo (algoName ))
16+ import System.Nix.Store.Types (FileIngestionMethod (.. ))
1617import System.Nix.StorePath (StoreDir , StorePath (StorePath ), StorePathName )
1718
1819import qualified Crypto.Hash
@@ -66,20 +67,21 @@ makeFixedOutputPath
6667 :: forall hashAlgo
6768 . NamedAlgo hashAlgo
6869 => StoreDir
69- -> Bool
70+ -> FileIngestionMethod
7071 -> Digest hashAlgo
7172 -> StorePathName
7273 -> StorePath
7374makeFixedOutputPath storeDir recursive h =
74- if recursive && (algoName @ hashAlgo ) == " sha256"
75- then makeStorePath storeDir " source" h
76- else makeStorePath storeDir " output:out" h'
75+ if recursive == FileIngestionMethod_FileRecursive
76+ && (algoName @ hashAlgo ) == " sha256"
77+ then makeStorePath storeDir " source" h
78+ else makeStorePath storeDir " output:out" h'
7779 where
7880 h' =
7981 Crypto.Hash. hash @ ByteString @ SHA256
8082 $ " fixed:out:"
8183 <> Data.Text.Encoding. encodeUtf8 (algoName @ hashAlgo )
82- <> (if recursive then " :r:" else " :" )
84+ <> (if recursive == FileIngestionMethod_FileRecursive then " :r:" else " :" )
8385 <> Data.Text.Encoding. encodeUtf8 (System.Nix.Hash. encodeDigestWith Base16 h)
8486 <> " :"
8587
@@ -96,12 +98,15 @@ computeStorePathForPath
9698 :: StoreDir
9799 -> StorePathName -- ^ Name part of the newly created `StorePath`
98100 -> FilePath -- ^ Local `FilePath` to add
99- -> Bool -- ^ Add target directory recursively
101+ -> FileIngestionMethod -- ^ Add target directory recursively
100102 -> (FilePath -> Bool ) -- ^ Path filter function
101103 -> Bool -- ^ Only used by local store backend
102104 -> IO StorePath
103105computeStorePathForPath storeDir name pth recursive _pathFilter _repair = do
104- selectedHash <- if recursive then recursiveContentHash else flatContentHash
106+ selectedHash <-
107+ if recursive == FileIngestionMethod_FileRecursive
108+ then recursiveContentHash
109+ else flatContentHash
105110 pure $ makeFixedOutputPath storeDir recursive selectedHash name
106111 where
107112 recursiveContentHash :: IO (Digest SHA256 )
0 commit comments