|
Nix 2.34.6
Nix, the purely functional package manager: C API (experimental)
|
Functions for extracting data from Nix values. More...
Functions | |
| ValueType | nix_get_type (nix_c_context *context, const nix_value *value) |
| Get value type. | |
| const char * | nix_get_typename (nix_c_context *context, const nix_value *value) |
| Get type name of value as defined in the evaluator. | |
| bool | nix_get_bool (nix_c_context *context, const nix_value *value) |
| Get boolean value. | |
| nix_err | nix_get_string (nix_c_context *context, const nix_value *value, nix_get_string_callback callback, void *user_data) |
| Get the raw string. | |
| const char * | nix_get_path_string (nix_c_context *context, const nix_value *value) |
| Get path as string. | |
| unsigned int | nix_get_list_size (nix_c_context *context, const nix_value *value) |
| Get the length of a list. | |
| unsigned int | nix_get_attrs_size (nix_c_context *context, const nix_value *value) |
| Get the element count of an attrset. | |
| double | nix_get_float (nix_c_context *context, const nix_value *value) |
| Get float value in 64 bits. | |
| int64_t | nix_get_int (nix_c_context *context, const nix_value *value) |
| Get int value. | |
| ExternalValue * | nix_get_external (nix_c_context *context, nix_value *value) |
| Get external reference. | |
| nix_value * | nix_get_list_byidx (nix_c_context *context, const nix_value *value, EvalState *state, unsigned int ix) |
| Get the ix'th element of a list. | |
| nix_value * | nix_get_list_byidx_lazy (nix_c_context *context, const nix_value *value, EvalState *state, unsigned int ix) |
| Get the ix'th element of a list without forcing evaluation of the element. | |
| nix_value * | nix_get_attr_byname (nix_c_context *context, const nix_value *value, EvalState *state, const char *name) |
| Get an attr by name. | |
| nix_value * | nix_get_attr_byname_lazy (nix_c_context *context, const nix_value *value, EvalState *state, const char *name) |
| Get an attribute value by attribute name, without forcing evaluation of the attribute's value. | |
| bool | nix_has_attr_byname (nix_c_context *context, const nix_value *value, EvalState *state, const char *name) |
| Check if an attribute name exists on a value. | |
| nix_value * | nix_get_attr_byidx (nix_c_context *context, nix_value *value, EvalState *state, unsigned int i, const char **name) |
| Get an attribute by index. | |
| nix_value * | nix_get_attr_byidx_lazy (nix_c_context *context, nix_value *value, EvalState *state, unsigned int i, const char **name) |
| Get an attribute by index, without forcing evaluation of the attribute's value. | |
| const char * | nix_get_attr_name_byidx (nix_c_context *context, nix_value *value, EvalState *state, unsigned int i) |
| Get an attribute name by index. | |
Functions for extracting data from Nix values.
| nix_value * nix_get_attr_byidx | ( | nix_c_context * | context, |
| nix_value * | value, | ||
| EvalState * | state, | ||
| unsigned int | i, | ||
| const char ** | name ) |
Get an attribute by index.
Also gives you the name.
Attributes are returned in an unspecified order which is NOT suitable for reproducible operations. In Nix's domain, reproducibility is paramount. The caller is responsible for sorting the attributes or storing them in an ordered map to ensure deterministic behavior in your application.
Call nix_value_decref() when you're done with the pointer
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect |
| [in] | state | nix evaluator state |
| [in] | i | attribute index |
| [out] | name | will store a pointer to the attribute name, valid until state is freed |
| nix_value * nix_get_attr_byidx_lazy | ( | nix_c_context * | context, |
| nix_value * | value, | ||
| EvalState * | state, | ||
| unsigned int | i, | ||
| const char ** | name ) |
Get an attribute by index, without forcing evaluation of the attribute's value.
Also gives you the name.
Returns the attribute value without forcing its evaluation, allowing access to lazy values. The attribute set value itself must already have been evaluated.
Attributes are returned in an unspecified order which is NOT suitable for reproducible operations. In Nix's domain, reproducibility is paramount. The caller is responsible for sorting the attributes or storing them in an ordered map to ensure deterministic behavior in your application.
Call nix_value_decref() when you're done with the pointer
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect (must be an evaluated attribute set) |
| [in] | state | nix evaluator state |
| [in] | i | attribute index |
| [out] | name | will store a pointer to the attribute name, valid until state is freed |
| nix_value * nix_get_attr_byname | ( | nix_c_context * | context, |
| const nix_value * | value, | ||
| EvalState * | state, | ||
| const char * | name ) |
Get an attr by name.
Call nix_value_decref() when you're done with the pointer
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect |
| [in] | state | nix evaluator state |
| [in] | name | attribute name |
| nix_value * nix_get_attr_byname_lazy | ( | nix_c_context * | context, |
| const nix_value * | value, | ||
| EvalState * | state, | ||
| const char * | name ) |
Get an attribute value by attribute name, without forcing evaluation of the attribute's value.
Returns the attribute value without forcing its evaluation, allowing access to lazy values. The attribute set value itself must already be evaluated.
Call nix_value_decref() when you're done with the pointer
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect (must be an evaluated attribute set) |
| [in] | state | nix evaluator state |
| [in] | name | attribute name |
| const char * nix_get_attr_name_byidx | ( | nix_c_context * | context, |
| nix_value * | value, | ||
| EvalState * | state, | ||
| unsigned int | i ) |
Get an attribute name by index.
Returns the attribute name without forcing evaluation of the attribute's value.
Attributes are returned in an unspecified order which is NOT suitable for reproducible operations. In Nix's domain, reproducibility is paramount. The caller is responsible for sorting the attributes or storing them in an ordered map to ensure deterministic behavior in your application.
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect |
| [in] | state | nix evaluator state |
| [in] | i | attribute index |
| unsigned int nix_get_attrs_size | ( | nix_c_context * | context, |
| const nix_value * | value ) |
Get the element count of an attrset.
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect |
| bool nix_get_bool | ( | nix_c_context * | context, |
| const nix_value * | value ) |
Get boolean value.
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect |
| ExternalValue * nix_get_external | ( | nix_c_context * | context, |
| nix_value * | value ) |
Get external reference.
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect |
| double nix_get_float | ( | nix_c_context * | context, |
| const nix_value * | value ) |
Get float value in 64 bits.
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect |
| int64_t nix_get_int | ( | nix_c_context * | context, |
| const nix_value * | value ) |
Get int value.
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect |
| nix_value * nix_get_list_byidx | ( | nix_c_context * | context, |
| const nix_value * | value, | ||
| EvalState * | state, | ||
| unsigned int | ix ) |
Get the ix'th element of a list.
Call nix_value_decref() when you're done with the pointer
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect |
| [in] | state | nix evaluator state |
| [in] | ix | list element to get |
| nix_value * nix_get_list_byidx_lazy | ( | nix_c_context * | context, |
| const nix_value * | value, | ||
| EvalState * | state, | ||
| unsigned int | ix ) |
Get the ix'th element of a list without forcing evaluation of the element.
Returns the list element without forcing its evaluation, allowing access to lazy values. The list value itself must already be evaluated.
Call nix_value_decref() when you're done with the pointer
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect (must be an evaluated list) |
| [in] | state | nix evaluator state |
| [in] | ix | list element to get |
| unsigned int nix_get_list_size | ( | nix_c_context * | context, |
| const nix_value * | value ) |
Get the length of a list.
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect |
| const char * nix_get_path_string | ( | nix_c_context * | context, |
| const nix_value * | value ) |
Get path as string.
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect |
| nix_err nix_get_string | ( | nix_c_context * | context, |
| const nix_value * | value, | ||
| nix_get_string_callback | callback, | ||
| void * | user_data ) |
Get the raw string.
This may contain placeholders.
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect |
| [in] | callback | Called with the string value. |
| [in] | user_data | optional, arbitrary data, passed to the callback when it's called. |
| ValueType nix_get_type | ( | nix_c_context * | context, |
| const nix_value * | value ) |
Get value type.
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect |
| const char * nix_get_typename | ( | nix_c_context * | context, |
| const nix_value * | value ) |
Get type name of value as defined in the evaluator.
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect |
| bool nix_has_attr_byname | ( | nix_c_context * | context, |
| const nix_value * | value, | ||
| EvalState * | state, | ||
| const char * | name ) |
Check if an attribute name exists on a value.
| [out] | context | Optional, stores error information |
| [in] | Value | Nix value to inspect |
| [in] | state | nix evaluator state |
| [in] | name | attribute name |