File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
hnix-store-core/src/System/Nix Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -150,14 +150,28 @@ storePathToRawFilePath StorePath {..} = BS.concat
150150 hashPart = encodeUtf8 $ encodeBase32 storePathHash
151151 name = encodeUtf8 $ unStorePathName storePathName
152152
153- storePathToNarinfo StorePath {.. } = BS. concat
153+ -- | Render a 'StorePath' as a 'FilePath'.
154+ storePathToFilePath
155+ :: StorePath
156+ -> FilePath
157+ storePathToFilePath = BC. unpack . storePathToRawFilePath
158+
159+ -- | Build `narinfo` suffix from `StorePath` which
160+ -- can be used to query binary caches.
161+ storePathToNarInfo
162+ :: StorePath
163+ -> BC. ByteString
164+ storePathToNarInfo StorePath {.. } = BS. concat
154165 [ encodeUtf8 $ encodeBase32 storePathHash
155166 , " .narinfo"
156167 ]
157168
158169-- | Parse `StorePath` from `BC.ByteString`, checking
159170-- that store directory matches `expectedRoot`.
160- parsePath :: FilePath -> BC. ByteString -> Either String StorePath
171+ parsePath
172+ :: FilePath
173+ -> BC. ByteString
174+ -> Either String StorePath
161175parsePath expectedRoot x =
162176 let
163177 (rootDir, fname) = splitFileName . BC. unpack $ x
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ module System.Nix.StorePath
1515 , validStorePathName
1616 , -- * Rendering out 'StorePath's
1717 storePathToRawFilePath
18+ , storePathToFilePath
19+ , storePathToNarInfo
1820 , parsePath
1921 ) where
2022
You can’t perform that action at this time.
0 commit comments