Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
System.Nix.Internal.StorePath
Description
Synopsis
- newtype StoreDir = StoreDir {
- unStoreDir :: RawFilePath
- data StorePath = StorePath {}
- newtype StorePathName = StorePathName {}
- type StorePathSet = HashSet StorePath
- mkStorePathHashPart :: ByteString -> StorePathHashPart
- newtype StorePathHashPart = StorePathHashPart ByteString
- data ContentAddressableAddress
- = Text !(Digest SHA256)
- | Fixed !NarHashMode !SomeNamedDigest
- data NarHashMode
- makeStorePathName :: Text -> Either String StorePathName
- validStorePathName :: Text -> Bool
- storePathToFilePath :: StoreDir -> StorePath -> FilePath
- storePathToRawFilePath :: StoreDir -> StorePath -> RawFilePath
- storePathToText :: StoreDir -> StorePath -> Text
- storePathToNarInfo :: StorePath -> ByteString
- parsePath :: StoreDir -> ByteString -> Either String StorePath
- pathParser :: StoreDir -> Parser StorePath
Basic store path types
The path to the store dir
Many operations need to be parameterized with this, since store paths do not know their own store dir by design.
Constructors
StoreDir | |
Fields
|
A path in a Nix store.
From the Nix thesis: A store path is the full path of a store object. It has the following anatomy: storeDir/hashPart-name.
The store directory is *not* included, and must be known from the context. This matches modern C++ Nix, and also represents the fact that store paths for different store directories cannot be mixed.
Constructors
StorePath | |
Fields
|
Instances
Show StorePath Source # | |
Eq StorePath Source # | |
Ord StorePath Source # | |
Hashable StorePath Source # | |
Defined in System.Nix.Internal.StorePath |
newtype StorePathName Source #
The name portion of a Nix path.
unStorePathName
must only contain a-zA-Z0-9+._?=-, can't start
with a -, and must have at least one character (i.e. it must match
storePathNameRegex
).
Constructors
StorePathName | |
Fields
|
Instances
Show StorePathName Source # | |
Defined in System.Nix.Internal.StorePath Methods showsPrec :: Int -> StorePathName -> ShowS # show :: StorePathName -> String # showList :: [StorePathName] -> ShowS # | |
Eq StorePathName Source # | |
Defined in System.Nix.Internal.StorePath Methods (==) :: StorePathName -> StorePathName -> Bool # (/=) :: StorePathName -> StorePathName -> Bool # | |
Ord StorePathName Source # | |
Defined in System.Nix.Internal.StorePath Methods compare :: StorePathName -> StorePathName -> Ordering # (<) :: StorePathName -> StorePathName -> Bool # (<=) :: StorePathName -> StorePathName -> Bool # (>) :: StorePathName -> StorePathName -> Bool # (>=) :: StorePathName -> StorePathName -> Bool # max :: StorePathName -> StorePathName -> StorePathName # min :: StorePathName -> StorePathName -> StorePathName # | |
Hashable StorePathName Source # | |
Defined in System.Nix.Internal.StorePath |
newtype StorePathHashPart Source #
The hash algorithm used for store path hashes.
Constructors
StorePathHashPart ByteString |
Instances
Show StorePathHashPart Source # | |
Defined in System.Nix.Internal.StorePath Methods showsPrec :: Int -> StorePathHashPart -> ShowS # show :: StorePathHashPart -> String # showList :: [StorePathHashPart] -> ShowS # | |
Eq StorePathHashPart Source # | |
Defined in System.Nix.Internal.StorePath Methods (==) :: StorePathHashPart -> StorePathHashPart -> Bool # (/=) :: StorePathHashPart -> StorePathHashPart -> Bool # | |
Ord StorePathHashPart Source # | |
Defined in System.Nix.Internal.StorePath Methods compare :: StorePathHashPart -> StorePathHashPart -> Ordering # (<) :: StorePathHashPart -> StorePathHashPart -> Bool # (<=) :: StorePathHashPart -> StorePathHashPart -> Bool # (>) :: StorePathHashPart -> StorePathHashPart -> Bool # (>=) :: StorePathHashPart -> StorePathHashPart -> Bool # max :: StorePathHashPart -> StorePathHashPart -> StorePathHashPart # min :: StorePathHashPart -> StorePathHashPart -> StorePathHashPart # | |
Hashable StorePathHashPart Source # | |
Defined in System.Nix.Internal.StorePath |
data ContentAddressableAddress Source #
An address for a content-addressable store path, i.e. one whose store path hash is purely a function of its contents (as opposed to paths that are derivation outputs, whose hashes are a function of the contents of the derivation file instead).
For backwards-compatibility reasons, the same information is encodable in multiple ways, depending on the method used to add the path to the store. These unfortunately result in separate store paths.
Constructors
Text !(Digest SHA256) | The path is a plain file added via makeTextPath or addTextToStore. It is addressed according to a sha256sum of the file contents. |
Fixed !NarHashMode !SomeNamedDigest | The path was added to the store via makeFixedOutputPath or
addToStore. It is addressed according to some hash algorithm
applied to the nar serialization via some |
data NarHashMode Source #
Schemes for hashing a Nix archive.
For backwards-compatibility reasons, there are two different modes
here, even though Recursive
should be able to cover both.
Constructors
RegularFile | Require the nar to represent a non-executable regular file. |
Recursive | Hash an arbitrary nar, including a non-executable regular file if so desired. |
Manipulating StorePathName
validStorePathName :: Text -> Bool Source #
Rendering out StorePath
s
storePathToRawFilePath :: StoreDir -> StorePath -> RawFilePath Source #
Render a StorePath
as a RawFilePath
.
storePathToText :: StoreDir -> StorePath -> Text Source #
Render a StorePath
as a ContentAddressableAddress
.
storePathToNarInfo :: StorePath -> ByteString Source #
Build narinfo
suffix from StorePath
which
can be used to query binary caches.
Parsing StorePath
s
parsePath :: StoreDir -> ByteString -> Either String StorePath Source #
Parse StorePath
from ByteString
, checking
that store directory matches expectedRoot
.