Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

helpers/mkResult

The primary way to define a result check.

Runs command in a derivation with set +e. Exit code, stdout, and stderr are captured in separate outputs (exitCode, stdout, stderr) rather than failing the build; the derivation always succeeds regardless of the command’s outcome.

For extra derivation attributes (e.g. nativeBuildInputs), use mkResultWith directly.

Type

mkResult :: String -> String -> Derivation

Arguments

name
Check name. Becomes the derivation name result-<name>.
command
Shell command to run as the check body.

Example

mkResult "hello" "hello --version"
mkResultWith {
  name = "result-grep-output";
  nativeBuildInputs = [ pkgs.ripgrep ];
  buildCommand = mkResult.buildCommand "rg 'pattern' somefile";
}