Skip to content

Commit d62d6a2

Browse files
committed
Add makeFixedOutputPath
1 parent 8cc6595 commit d62d6a2

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
@@ -24,6 +24,15 @@ makeStorePath storeDir ty h nm = Path storeHash (PathName nm)
2424
]
2525
storeHash = truncateDigest $ hash $ encodeUtf8 s
2626

27+
makeFixedOutputPath :: Text -> Bool -> Digest 'SHA256 -> Text -> Path
28+
makeFixedOutputPath storeDir recursive h nm =
29+
makeStorePath storeDir ty h' nm
30+
where
31+
(ty, h') =
32+
if recursive
33+
then ("source", h)
34+
else ("output:out", hash ("fixed:out:" <> encodeUtf8 (digestText16 h) <> ":"))
35+
2736
makeTextPath :: Text -> Text -> Digest 'SHA256 -> PathSet -> Path
2837
makeTextPath storeDir nm h refs = makeStorePath storeDir ty h nm
2938
where

0 commit comments

Comments
 (0)