Skip to main content

nix_get_derivation

Function nix_get_derivation 

Source
pub unsafe extern "C" fn nix_get_derivation(
    context: *mut nix_c_context,
    state: *mut EvalState,
    value: *mut nix_value,
    ignoreAssertionFailures: bool,
) -> *mut StorePath
Expand description

Determine whether a Nix value is a derivation and return its path. Forces value and, if it is a derivation, returns a newly allocated StorePath for its .drvPath. If the value is not a derivation, NULL is returned without setting an error. If forcing the value raises an assertion failure and ignoreAssertionFailures is true, the assertion failure is treated as “not a derivation” (NULL returned, no error); if false, the assertion is propagated as an error.

§Arguments

  • context [out] - Optional. Stores error information.
  • state [in] - Evaluator state.
  • value [in] - Value to inspect.
  • ignoreAssertionFailures [in] - When true, an AssertionError raised while forcing value is treated as “not a derivation” rather than an error.

§Returns

A newly allocated StorePath holding the derivation path, or NULL. Free a non-NULL result with nix_store_path_free().