hercules-ci-cnix-store-0.3.6.0: Haskell bindings for Nix's libstore
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hercules.CNix.Store

Synopsis

Opening a Store

newtype Store Source #

Constructors

Store (Ptr (Ref NixStore)) 

withStore :: MonadUnliftIO m => (Store -> m a) -> m a Source #

withStore' :: (Store -> IO r) -> IO r Source #

withStoreFromURI :: MonadUnliftIO m => Text -> (Store -> m r) -> m r Source #

Store properties

storeDir :: MonadIO m => Store -> m ByteString Source #

Usually "nixstore"

Store paths

newtype StorePath Source #

Store-agnostic store path representation: hash and name. Does not have a storedir or subpath inside the store path.

parseStorePathBaseName :: ByteString -> IO StorePath Source #

Create StorePath from hash and name.

Throws C++ BadStorePath exception when invalid.

parseStorePath :: Store -> ByteString -> IO StorePath Source #

Parse a complete store path including storeDir into a StorePath.

Throws C++ BadStorePath exception when invalid.

followLinksToStorePath :: Store -> ByteString -> IO StorePath Source #

Follow symlinks to the store and chop off the parts after the top-level store name

Store objects

isValidPath :: Store -> StorePath -> IO Bool Source #

Whether a path exists and is registered.

queryPathInfo Source #

Arguments

:: Store 
-> StorePath

Exact store path, not a subpath

-> IO (ForeignPtr (Ref ValidPathInfo))

ValidPathInfo or exception

queryPathInfoFromClientCache :: Store -> StorePath -> IO (Maybe (Maybe (ForeignPtr (Ref ValidPathInfo)))) Source #

Query only the local client cache ("narinfo cache") - does not query the actual store or daemon.

Returns Nothing if nothing is known about the path. Returns 'Just Nothing' if the path is known to not exist. Returns 'Just (Just vpi)' if the path is known to exist, with the given ValidPathInfo.

data ValidPathInfo Source #

Instances

Instances details
Finalizer (Ref ValidPathInfo) Source # 
Instance details

Defined in Hercules.CNix.Store

validPathInfoNarSize :: ForeignPtr (Ref ValidPathInfo) -> Int64 Source #

The narSize field of a ValidPathInfo struct. Source: path-info.hh / store-api.hh

validPathInfoNarHash32 :: ForeignPtr (Ref ValidPathInfo) -> IO ByteString Source #

Copy the narHash field of a ValidPathInfo struct. Source: path-info.hh / store-api.hh

validPathInfoDeriver :: Store -> ForeignPtr (Ref ValidPathInfo) -> IO (Maybe StorePath) Source #

Deriver field of a ValidPathInfo struct. Source: store-api.hh

validPathInfoReferences :: Store -> ForeignPtr (Ref ValidPathInfo) -> IO [StorePath] Source #

References field of a ValidPathInfo struct. Source: store-api.hh

Realisation

Garbage collection

In-memory cache control

Derivation references

Derivations

getDerivationFromString Source #

Arguments

:: Store 
-> ByteString

Derivation name (store path name with ".drv" extension removed)

-> ByteString

Contents

-> IO Derivation 

getDerivationInputs' :: Derivation -> IO [(StorePath, [ByteString])] Source #

Get the inputs of a derivation, ignoring dependencies on outputs of outputs (RFC 92 inputs).

Copying

Signing

data SecretKey Source #

Instances

Instances details
Finalizer SecretKey Source # 
Instance details

Defined in Hercules.CNix.Store

signPath Source #

Arguments

:: Store 
-> Ptr SecretKey

Secret signing key

-> StorePath

Store path

-> IO Bool

False if the signature was already present, True if the signature was added

Hashes

data Hash Source #

See hash.hh

Constructors

Hash !HashType !ShortByteString 

Instances

Instances details
Show Hash Source # 
Instance details

Defined in Hercules.CNix.Store

Methods

showsPrec :: Int -> Hash -> ShowS #

show :: Hash -> String #

showList :: [Hash] -> ShowS #

Eq Hash Source # 
Instance details

Defined in Hercules.CNix.Store

Methods

(==) :: Hash -> Hash -> Bool #

(/=) :: Hash -> Hash -> Bool #

data HashType Source #

See hash.hh

Constructors

MD5 
SHA1 
SHA256 
SHA512 

Instances

Instances details
Show HashType Source # 
Instance details

Defined in Hercules.CNix.Store

Eq HashType Source # 
Instance details

Defined in Hercules.CNix.Store

Utilities

data Strings Source #

A Nix Strings aka std::liststd::string

Instances

Instances details
Delete Strings Source # 
Instance details

Defined in Hercules.CNix.Store

Methods

delete :: Ptr Strings -> IO () Source #

Finalizer Strings Source # 
Instance details

Defined in Hercules.CNix.Store

Deprecated

forNonNull :: Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) Source #

Deprecated: Use forNonNull instead

traverseNonNull :: (Ptr a -> IO b) -> Ptr a -> IO (Maybe b) Source #

Deprecated: Use traverseNonNull instead

deleteStringPairs :: Ptr StringPairs -> IO () Source #

Deprecated: Use delete instead

deleteStrings :: Ptr Strings -> IO () Source #

Deprecated: Use delete instead

moveStorePath :: Ptr NixStorePath -> IO StorePath Source #

Deprecated: Use moveToForeignPtrWrapper instead

Move ownership of a Ptr NixStorePath into StorePath

moveStorePathMaybe :: Ptr NixStorePath -> IO (Maybe StorePath) Source #

Deprecated: Use nullableMoveToForeignPtrWrapper instead

Move ownership of a Ptr NixStorePath into StorePath

unsafeMallocBS :: MonadIO m => IO CString -> m ByteString Source #

Deprecated: Use unsafePackMallocCString

withPtr' :: Coercible a' (ForeignPtr a) => a' -> (Ptr a -> IO b) -> IO b Source #

Deprecated: Use HasEncapsulation instead

data DerivationInputsIterator Source #

Instances

Instances details
Delete DerivationInputsIterator Source # 
Instance details

Defined in Hercules.CNix.Store

data DerivationOutputsIterator Source #

Instances

Instances details
Delete DerivationOutputsIterator Source # 
Instance details

Defined in Hercules.CNix.Store

data NixStore Source #

Instances

Instances details
Delete (Ref NixStore) Source # 
Instance details

Defined in Hercules.CNix.Store

Methods

delete :: Ptr (Ref NixStore) -> IO () Source #

data Ref a Source #

A Nix ref, to be used in phantom types.

Instances

Instances details
Delete (Ref NixStore) Source # 
Instance details

Defined in Hercules.CNix.Store

Methods

delete :: Ptr (Ref NixStore) -> IO () Source #

Finalizer (Ref ValidPathInfo) Source # 
Instance details

Defined in Hercules.CNix.Store

data StringPairs Source #

Instances

Instances details
Delete StringPairs Source # 
Instance details

Defined in Hercules.CNix.Store

Methods

delete :: Ptr StringPairs -> IO () Source #

Re-exports

Orphan instances