Copyright | Profpatsch 2016–2018 |
---|---|
License | GPL-3 |
Stability | experimental |
Portability | nix 1.11.x, nix 2.0 |
Safe Haskell | None |
Language | Haskell2010 |
Calls to the nix command line to convert textual nix expressions to derivations & realized storepaths.
Synopsis
- parseNixExpr :: MonadIO m => Text -> NixAction ParseError m NixExpr
- data ParseError
- instantiate :: MonadIO m => NixExpr -> NixAction InstantiateError m (StorePath Derivation)
- data InstantiateError
- eval :: MonadIO m => NixExpr -> NixAction InstantiateError m ()
- realize :: MonadIO m => StorePath Derivation -> NixAction RealizeError m (StorePath Realized)
- data RealizeError = UnknownRealizeError
- addToStore :: MonadIO m => FilePath -> NixAction RealizeError m (StorePath Realized)
- parseInstRealize :: MonadIO m => Text -> NixAction NixError m (StorePath Realized)
- data NixError
- data NixExpr
- module Foreign.Nix.Shellout.Types
Calling nix
Parse
parseNixExpr :: MonadIO m => Text -> NixAction ParseError m NixExpr Source #
Parse a nix expression and check for syntactic validity.
data ParseError Source #
SyntaxError Text | the input string was not a syntactically valid nix expression |
UnknownParseError | catch-all error |
Instances
Eq ParseError Source # | |
Defined in Foreign.Nix.Shellout (==) :: ParseError -> ParseError -> Bool # (/=) :: ParseError -> ParseError -> Bool # | |
Show ParseError Source # | |
Defined in Foreign.Nix.Shellout showsPrec :: Int -> ParseError -> ShowS # show :: ParseError -> String # showList :: [ParseError] -> ShowS # |
Instantiate
instantiate :: MonadIO m => NixExpr -> NixAction InstantiateError m (StorePath Derivation) Source #
Instantiate a parsed expression into a derivation.
Runs nix-instantiate
.
data InstantiateError Source #
NotADerivation | the given expression does not evaluate to a derivaton |
UnknownInstantiateError | catch-all error |
Instances
Eq InstantiateError Source # | |
Defined in Foreign.Nix.Shellout (==) :: InstantiateError -> InstantiateError -> Bool # (/=) :: InstantiateError -> InstantiateError -> Bool # | |
Show InstantiateError Source # | |
Defined in Foreign.Nix.Shellout showsPrec :: Int -> InstantiateError -> ShowS # show :: InstantiateError -> String # showList :: [InstantiateError] -> ShowS # |
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 #
Instances
Eq RealizeError Source # | |
Defined in Foreign.Nix.Shellout (==) :: RealizeError -> RealizeError -> Bool # (/=) :: RealizeError -> RealizeError -> Bool # | |
Show RealizeError Source # | |
Defined in Foreign.Nix.Shellout showsPrec :: Int -> RealizeError -> ShowS # show :: RealizeError -> String # showList :: [RealizeError] -> ShowS # |
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.
Combines all error types that could happen.
Types
A sucessfully parsed nix expression.
module Foreign.Nix.Shellout.Types