libnix-0.4.1.0: Bindings to the nix package manager
CopyrightProfpatsch 2016–2018
LicenseGPL-3
Stabilityexperimental
Portabilitynix 1.11.x, nix 2.0
Safe HaskellNone
LanguageHaskell2010

Foreign.Nix.Shellout

Description

Calls to the nix command line to convert textual nix expressions to derivations & realized storepaths.

Synopsis

Calling nix

Parse

parseNixExpr :: MonadIO m => Text -> NixAction ParseError m NixExpr Source #

Parse a nix expression and check for syntactic validity.

data ParseError Source #

Constructors

SyntaxError Text

the input string was not a syntactically valid nix expression

UnknownParseError

catch-all error

Instances

Instances details
Eq ParseError Source # 
Instance details

Defined in Foreign.Nix.Shellout

Show ParseError Source # 
Instance details

Defined in Foreign.Nix.Shellout

Instantiate

instantiate :: MonadIO m => NixExpr -> NixAction InstantiateError m (StorePath Derivation) Source #

Instantiate a parsed expression into a derivation.

Runs nix-instantiate.

data InstantiateError Source #

Constructors

NotADerivation

the given expression does not evaluate to a derivaton

UnknownInstantiateError

catch-all error

eval :: MonadIO m => NixExpr -> NixAction InstantiateError m () Source #

Just tests if the expression can be evaluated. That doesn’t mean it has to instantiate however.

Runs nix-instantiate.

Realize

realize :: MonadIO m => StorePath Derivation -> NixAction RealizeError m (StorePath Realized) Source #

Finally derivations are realized into full store outputs. This will typically take a while so it should be executed asynchronously.

Runs nix-store.

data RealizeError Source #

Constructors

UnknownRealizeError 

Instances

Instances details
Eq RealizeError Source # 
Instance details

Defined in Foreign.Nix.Shellout

Show RealizeError Source # 
Instance details

Defined in Foreign.Nix.Shellout

Helpers

addToStore :: MonadIO m => FilePath -> NixAction RealizeError m (StorePath Realized) Source #

Copy the given file or folder to the nix store and return it’s path.

Runs nix-store.

parseInstRealize :: MonadIO m => Text -> NixAction NixError m (StorePath Realized) Source #

A convenience function to directly realize a nix expression. Any errors are put into a combined error type.

data NixError Source #

Combines all error types that could happen.

Instances

Instances details
Eq NixError Source # 
Instance details

Defined in Foreign.Nix.Shellout

Show NixError Source # 
Instance details

Defined in Foreign.Nix.Shellout

Types

data NixExpr Source #

A sucessfully parsed nix expression.

Instances

Instances details
Show NixExpr Source # 
Instance details

Defined in Foreign.Nix.Shellout