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 :: Text -> NixAction ParseError NixExpr
- data ParseError
- instantiate :: NixExpr -> NixAction InstantiateError (StorePath Derivation)
- data InstantiateError
- eval :: NixExpr -> NixAction InstantiateError ()
- realize :: StorePath Derivation -> NixAction RealizeError (StorePath Realized)
- data RealizeError = UnknownRealizeError
- addToStore :: FilePath -> NixAction RealizeError (StorePath Realized)
- parseInstRealize :: Text -> NixAction NixError (StorePath Realized)
- data NixError
- data StorePath a
- data Derivation
- data Realized
- data NixExpr
- runNixAction :: NixAction e a -> IO (Either (Text, e) a)
- newtype NixAction e a = NixAction {
- unNixAction :: ExceptT (Text, e) IO a
Calling nix
Parse
parseNixExpr :: Text -> NixAction ParseError 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 :: NixExpr -> NixAction InstantiateError (StorePath Derivation) Source #
Instantiate a parsed expression into a derivation.
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 :: NixExpr -> NixAction InstantiateError () Source #
Just tests if the expression can be evaluated. That doesn’t mean it has to instantiate however.
Realize
realize :: StorePath Derivation -> NixAction RealizeError (StorePath Realized) Source #
Finally derivations are realized into full store outputs. This will typically take a while so it should be executed asynchronously.
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 :: FilePath -> NixAction RealizeError (StorePath Realized) Source #
Copy the given file or folder to the nix store and return it’s path.
parseInstRealize :: Text -> NixAction NixError (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 path in the nix store. It carries a phantom a
to differentiate
between Derivation
files and Realized
paths.
data Derivation Source #
A nix derivation is a complete build instruction that can be realized.
A sucessfully parsed nix expression.
newtype NixAction e a Source #
Calls a command that returns an error and the whole stderr on failure.
NixAction | |
|