@@ -89,27 +89,27 @@ makeFixedOutputPath
8989 -> StorePathName
9090 -> StorePath
9191makeFixedOutputPath storeDir method digest@ (hashAlgo :=> h) refs =
92- case method of
92+ makeStorePath storeDir ty digest'
93+ where
94+ (ty, digest') = case method of
9395 ContentAddressMethod_Text ->
9496 case hashAlgo of
9597 HashAlgo_SHA256
96- | references_self refs == False -> makeStorePath storeDir ty digest
97- where
98- ty = makeType storeDir " text" refs
98+ | references_self refs == False -> (makeType storeDir " text" refs, digest)
9999 _ -> error " unsupported" -- TODO do better; maybe we'll just remove this restriction too?
100100 _ ->
101101 if method == ContentAddressMethod_NixArchive
102102 && Some hashAlgo == Some HashAlgo_SHA256
103- then makeStorePath storeDir (makeType storeDir " source" refs) digest
104- else makeStorePath storeDir " output:out " ( HashAlgo_SHA256 :=> h')
105- where
106- h' =
107- Crypto.Hash. hash @ ByteString @ SHA256
108- $ " fixed:out: "
109- <> Data.Text.Encoding. encodeUtf8 ( System.Nix.Hash. algoToText hashAlgo )
110- <> ( if method == ContentAddressMethod_NixArchive then " :r: " else " : " )
111- <> Data.Text.Encoding. encodeUtf8 ( System.Nix.Hash. encodeDigestWith Base16 h)
112- <> " : "
103+ then (makeType storeDir " source" refs, digest)
104+ else let
105+ h' =
106+ Crypto.Hash. hash @ ByteString @ SHA256
107+ $ " fixed:out: "
108+ <> Data.Text.Encoding. encodeUtf8 ( System.Nix.Hash. algoToText hashAlgo)
109+ <> ( if method == ContentAddressMethod_NixArchive then " :r: " else " : " )
110+ <> Data.Text.Encoding. encodeUtf8 ( System.Nix.Hash. encodeDigestWith Base16 h )
111+ <> " : "
112+ in ( " output:out " , HashAlgo_SHA256 :=> h')
113113
114114digestPath
115115 :: FilePath -- ^ Local `FilePath` to add
0 commit comments