pub unsafe extern "C" fn get_derivation(
context: *mut c_context,
state: *mut EvalState,
value: *mut value,
ignoreAssertionFailures: bool,
) -> *mut StorePathExpand description
@brief Determine whether a Nix value is a derivation and, if so, return its store derivation path.
Forces @p value and inspects it. The value is considered a derivation when it
is an attribute set whose type attribute is the string "derivation"; in
that case its drvPath attribute is parsed and returned. Otherwise NULL is
returned without recording an error.
Only the derivation path is returned. Other metadata (name, system,
outputs, meta, …) lives on @p value itself and can be read with the
attribute-set accessors such as nix_get_attr_byname() and nix_get_string().
@param[out] context Optional, stores error information. On a NULL return, inspect the error code via nix_err_code() to tell the two NULL cases apart: NIX_OK means @p value is simply not a derivation, any other code means inspection failed. See @ref errors. @param[in] state The evaluation state. @param[in] value The value to inspect. It is forced by this call. @param[in] ignoreAssertionFailures If true, an assertion failure raised while forcing @p value is treated as “not a derivation” (NULL is returned without an error) rather than being reported as an error. @return A newly allocated StorePath holding the derivation path, or NULL. Free a non-NULL result with nix_store_path_free().