Skip to content

Commit c46d7c3

Browse files
puffnfreshsorki
authored andcommitted
Add makeFixedOutputPath
1 parent 61b1c16 commit c46d7c3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

hnix-store-core/src/System/Nix/ReadonlyStore.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,14 @@ makeTextPath nm h refs = makeStorePath ty h nm
2828
where
2929
ty = BS.intercalate ":" ("text" : map storePathToRawFilePath (HS.toList refs))
3030

31+
makeFixedOutputPath :: (KnownStoreDir storeDir, ValidAlgo hashAlgo, NamedAlgo hashAlgo) => Bool -> Digest hashAlgo -> StorePathName -> StorePath storeDir
32+
makeFixedOutputPath recursive h nm =
33+
makeStorePath ty h' nm
34+
where
35+
(ty, h') =
36+
if recursive
37+
then ("source", h)
38+
else ("output:out", hash ("fixed:out:" <> encodeUtf8 (encodeBase16 h) <> ":"))
39+
3140
computeStorePathForText :: (KnownStoreDir storeDir) => StorePathName -> ByteString -> StorePathSet storeDir -> StorePath storeDir
3241
computeStorePathForText nm s refs = makeTextPath nm (hash s) refs

0 commit comments

Comments
 (0)