File tree Expand file tree Collapse file tree 1 file changed +17
-8
lines changed
hnix-store-core/src/System/Nix Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,12 @@ import Data.Text.Encoding
1212import System.Nix.Hash
1313import System.Nix.StorePath
1414
15- makeStorePath :: forall hashAlgo . (NamedAlgo hashAlgo ) => FilePath -> ByteString -> Digest hashAlgo -> StorePathName -> StorePath
15+ makeStorePath :: forall hashAlgo . (NamedAlgo hashAlgo )
16+ => FilePath
17+ -> ByteString
18+ -> Digest hashAlgo
19+ -> StorePathName
20+ -> StorePath
1621makeStorePath fp ty h nm = StorePath storeHash nm fp
1722 where
1823 s = BS. intercalate " :"
@@ -29,14 +34,18 @@ makeTextPath fp nm h refs = makeStorePath fp ty h nm
2934 where
3035 ty = BS. intercalate " :" (" text" : map storePathToRawFilePath (HS. toList refs))
3136
32- makeFixedOutputPath :: forall hashAlgo . (ValidAlgo hashAlgo , NamedAlgo hashAlgo ) => FilePath -> Bool -> Digest hashAlgo -> StorePathName -> StorePath
37+ makeFixedOutputPath :: forall hashAlgo . (ValidAlgo hashAlgo , NamedAlgo hashAlgo )
38+ => FilePath
39+ -> Bool
40+ -> Digest hashAlgo
41+ -> StorePathName
42+ -> StorePath
3343makeFixedOutputPath fp recursive h nm =
34- makeStorePath fp ty h' nm
35- where
36- (ty, h') =
37- if recursive && algoName @ hashAlgo == algoName @ 'SHA256
38- then (" source" , h)
39- else (" output:out" , hash (" fixed:out:" <> encodeUtf8 (encodeBase16 h) <> " :" ))
44+ if recursive && (algoName @ hashAlgo ) == " sha256"
45+ then makeStorePath fp " source" h nm
46+ else makeStorePath fp " output:out" h' nm
47+ where
48+ h' = hash @ 'SHA256 $ " fixed:out:" <> encodeUtf8 (algoName @ hashAlgo ) <> (if recursive then " :r:" else " :" ) <> encodeUtf8 (encodeBase16 h) <> " :"
4049
4150computeStorePathForText :: FilePath -> StorePathName -> ByteString -> StorePathSet -> StorePath
4251computeStorePathForText fp nm s refs = makeTextPath fp nm (hash s) refs
You can’t perform that action at this time.
0 commit comments