hnix-store-core-0.6.0.0: Core effects for interacting with the Nix store.
Safe HaskellNone
LanguageHaskell2010

System.Nix.StorePath

Description

 
Synopsis

Basic store path types

data StorePath Source #

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.

storeDir: The root of the Nix store (e.g. /nix/store).

See the StoreDir haddocks for details on why we represent this at the type level.

Constructors

StorePath 

Fields

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

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 NarHashMode.

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

Rendering out StorePaths

storePathToRawFilePath :: StorePath -> RawFilePath Source #

Render a StorePath as a RawFilePath.

storePathToNarInfo :: StorePath -> ByteString Source #

Build narinfo suffix from StorePath which can be used to query binary caches.

Parsing StorePaths

parsePath :: FilePath -> ByteString -> Either String StorePath Source #

Parse StorePath from ByteString, checking that store directory matches expectedRoot.