Skip to main content

Crate nix_bindings_sys

Crate nix_bindings_sys 

Source
Expand description

§nix-bindings-sys

Raw, unsafe FFI bindings to the Nix C API.

§Safety

These bindings are generated automatically and map directly to the C API. They are unsafe to use directly. Prefer using the high-level safe API in the parent crate unless you know what you’re doing.

Structs§

BindingsBuilder
Stores an under-construction set of bindings @ingroup value_create
EvalState
Represents a state of the Nix language evaluator.
ExternalValue
External Value @ingroup Externals
ListBuilder
Stores an under-construction list @ingroup value_create
NixCExternalValueDesc
Definition for a class of external values
PrimOp
PrimOp function @ingroup primops
Store
Reference to a Nix store
StorePath
Nix store path
nix_c_context
This object stores error state. @struct nix_c_context
nix_derivation
Nix Derivation
nix_eval_state_builder
Builder for EvalState
nix_fetchers_settings
Shared settings object
nix_flake_lock_flags
Parameters for locking a flake
nix_flake_reference
A reference to a flake
nix_flake_reference_parse_flags
Context and parameters for parsing a flake reference
nix_flake_settings
A settings object for configuring the behavior of the nix-flake-c library.
nix_locked_flake
A flake with a suitable lock (file or otherwise)
nix_printer
Wraps a stream that can output multiple string pieces.
nix_realised_string
String without placeholders, and realised store paths @struct nix_realised_string
nix_store_path_hash_part
A store path hash
nix_string_context
A list of string context items
nix_string_return
Represents a string owned by the Nix language evaluator.
nix_value
A Nix language value, or thunk that may evaluate to a value. @ingroup value

Constants§

ValueType_NIX_TYPE_ATTRS
Attribute set (key-value mapping)
ValueType_NIX_TYPE_BOOL
Boolean true or false value
ValueType_NIX_TYPE_EXTERNAL
External value from C++ plugins or C API
ValueType_NIX_TYPE_FAILED
External value from C++ plugins or C API
ValueType_NIX_TYPE_FLOAT
IEEE 754 double precision floating point number
ValueType_NIX_TYPE_FUNCTION
Function (lambda or builtin)
ValueType_NIX_TYPE_INT
A 64 bit signed integer.
ValueType_NIX_TYPE_LIST
Ordered list of values
ValueType_NIX_TYPE_NULL
Null value
ValueType_NIX_TYPE_PATH
Filesystem path
ValueType_NIX_TYPE_STRING
String value with context
ValueType_NIX_TYPE_THUNK
Unevaluated expression
nix_err_NIX_ERR_KEY
A key/index access error occurred in C API functions.
nix_err_NIX_ERR_NIX_ERROR
A generic Nix error occurred.
nix_err_NIX_ERR_OVERFLOW
An overflow error occurred.
nix_err_NIX_ERR_RECOVERABLE
A recoverable error occurred.
nix_err_NIX_ERR_UNKNOWN
An unknown error occurred.
nix_err_NIX_OK
No error occurred.
nix_verbosity_NIX_LVL_CHATTY
nix_verbosity_NIX_LVL_DEBUG
nix_verbosity_NIX_LVL_ERROR
nix_verbosity_NIX_LVL_INFO
nix_verbosity_NIX_LVL_NOTICE
nix_verbosity_NIX_LVL_TALKATIVE
nix_verbosity_NIX_LVL_VOMIT
nix_verbosity_NIX_LVL_WARN

Functions§

nix_add_derivation⚠
Add the given nix_derivation to the given store
nix_alloc_primop⚠
Allocate a PrimOp @ingroup primops
nix_alloc_value⚠
Allocate a Nix value @ingroup value_create
nix_bindings_builder_free⚠
Free a bindings builder
nix_bindings_builder_insert⚠
Insert bindings into a builder
nix_c_context_create⚠
Allocate a new nix_c_context. @throws std::bad_alloc
nix_c_context_free⚠
Free a nix_c_context. Does not fail.
nix_clear_err⚠
Clear the error message from a nix context.
nix_copy_value⚠
Copy from another value @ingroup value_create
nix_create_external_value⚠
Create an external value, that can be given to nix_init_external
nix_derivation_clone⚠
Copy a nix_derivation
nix_derivation_free⚠
Deallocate a nix_derivation
nix_derivation_from_json⚠
Create a nix_derivation from a JSON representation of that derivation.
nix_derivation_to_json⚠
Gets the derivation as a JSON string
nix_err_code⚠
Retrieves the most recent error code from a nix_c_context
nix_err_info_msg⚠
Retrieves the error message from errorInfo in a context.
nix_err_msg⚠
@addtogroup errors Retrieves the most recent error message from a context.
nix_err_name⚠
Retrieves the error name from a context.
nix_eval_state_allow_path⚠
Register a store path in the evaluator’s access allowlist.
nix_eval_state_build⚠
Create a new Nix language evaluator state @ingroup libexpr_init
nix_eval_state_builder_free⚠
Free a nix_eval_state_builder @ingroup libexpr_init
nix_eval_state_builder_load⚠
Read settings from the ambient environment @ingroup libexpr_init
nix_eval_state_builder_new⚠
Create a new nix_eval_state_builder @ingroup libexpr_init
nix_eval_state_builder_set_lookup_path⚠
Set the lookup path for <...> expressions @ingroup libexpr_init
nix_expr_eval_from_string⚠
Parses and evaluates a Nix expression from a string. @ingroup value_create
nix_external_add_string_context⚠
Add string context to the nix_string_context object
nix_external_print⚠
Print to the nix_printer
nix_fetchers_settings_free⚠
nix_fetchers_settings_new⚠
nix_flake_lock⚠
Lock a flake, if not already locked.
nix_flake_lock_flags_add_input_override⚠
Add input overrides to the lock flags
nix_flake_lock_flags_free⚠
Deallocate and release the resources associated with a nix_flake_lock_flags. Does not fail.
nix_flake_lock_flags_new⚠
A new nix_flake_lock_flags with defaults
nix_flake_lock_flags_set_mode_check⚠
Put the lock flags in a mode that checks whether the lock is up to date.
nix_flake_lock_flags_set_mode_virtual⚠
Put the lock flags in a mode that updates the lock file in memory, if needed.
nix_flake_lock_flags_set_mode_write_as_needed⚠
Put the lock flags in a mode that updates the lock file on disk, if needed.
nix_flake_reference_and_fragment_from_string⚠
Parse a URL-like string into a nix_flake_reference.
nix_flake_reference_free⚠
Deallocate and release the resources associated with a nix_flake_reference.
nix_flake_reference_parse_flags_free⚠
Deallocate and release the resources associated with a nix_flake_reference_parse_flags. Does not fail.
nix_flake_reference_parse_flags_new⚠
A new nix_flake_reference_parse_flags with defaults
nix_flake_reference_parse_flags_set_base_directory⚠
Provide a base directory for parsing relative flake references
nix_flake_settings_add_to_eval_state_builder⚠
Initialize a nix_flake_settings to contain builtins.getFlake and potentially more.
nix_flake_settings_free⚠
Release the resources associated with a nix_flake_settings.
nix_flake_settings_new⚠
Create a nix_flake_settings initialized with default values.
nix_gc_decref⚠
Decrement the garbage collector reference counter for the given object
nix_gc_incref⚠
Increment the garbage collector reference counter for the given object.
nix_gc_now⚠
Trigger the garbage collector manually
nix_gc_register_finalizer⚠
Register a callback that gets called when the object is garbage collected.
nix_get_attr_byidx⚠
Get an attribute by index @ingroup value_extract
nix_get_attr_byidx_lazy⚠
Get an attribute by index, without forcing evaluation of the attribute’s value @ingroup value_extract
nix_get_attr_byname⚠
Get an attr by name @ingroup value_extract
nix_get_attr_byname_lazy⚠
Get an attribute value by attribute name, without forcing evaluation of the attribute’s value @ingroup value_extract
nix_get_attr_name_byidx⚠
Get an attribute name by index @ingroup value_extract
nix_get_attrs_size⚠
Get the element count of an attrset @ingroup value_extract
nix_get_bool⚠
Get boolean value @ingroup value_extract
nix_get_derivation⚠
Determine whether a Nix value is a derivation and return its path.
nix_get_external⚠
Get external reference @ingroup value_extract
nix_get_external_value_content⚠
Extract the pointer from a Nix C API external value.
nix_get_float⚠
Get float value in 64 bits @ingroup value_extract
nix_get_int⚠
Get int value @ingroup value_extract
nix_get_list_byidx⚠
Get the ix’th element of a list @ingroup value_extract
nix_get_list_byidx_lazy⚠
Get the ix’th element of a list without forcing evaluation of the element @ingroup value_extract
nix_get_list_size⚠
Get the length of a list @ingroup value_extract
nix_get_path_string⚠
Get path as string @ingroup value_extract
nix_get_string⚠
Get the raw string @ingroup value_extract
nix_get_type⚠
Get value type @ingroup value_extract
nix_get_typename⚠
Get type name of value as defined in the evaluator @ingroup value_extract
nix_has_attr_byname⚠
Check if an attribute name exists on a value @ingroup value_extract
nix_init_apply⚠
Set the value to a thunk that will perform a function application when needed. @ingroup value_create
nix_init_bool⚠
@name Initializers
nix_init_external⚠
Set an external value @ingroup value_create
nix_init_float⚠
Set a float @ingroup value_create
nix_init_int⚠
Set an int @ingroup value_create
nix_init_null⚠
Set null @ingroup value_create
nix_init_path_string⚠
Set a path @ingroup value_create
nix_init_plugins⚠
Loads the plugins specified in Nix’s plugin-files setting.
nix_init_primop⚠
Set primop @ingroup value_create
nix_init_string⚠
Set a string @ingroup value_create
nix_libexpr_init⚠
Initialize the Nix language evaluator. @ingroup libexpr_init
nix_libstore_init⚠
Initializes the Nix store library
nix_libstore_init_no_load_config⚠
Like nix_libstore_init, but does not load the Nix configuration.
nix_libutil_init⚠
Initializes nix_libutil and its dependencies.
nix_list_builder_free⚠
Free a list builder
nix_list_builder_insert⚠
Insert bindings into a builder
nix_locked_flake_export_json⚠
Export a locked flake as an owned JSON graph.
nix_locked_flake_free⚠
Deallocate and release the resources associated with a nix_locked_flake. Does not fail.
nix_locked_flake_get_output_attrs⚠
Get the output attributes of a flake.
nix_locked_flake_import_json⚠
Import a locked flake from an owned JSON graph.
nix_make_attrs⚠
Create an attribute set from a bindings builder @ingroup value_create
nix_make_bindings_builder⚠
Create a bindings builder
nix_make_list⚠
Create a list from a list builder @ingroup value_create
nix_make_list_builder⚠
Create a list builder @ingroup value_create
nix_realised_string_free⚠
Free a realised string
nix_realised_string_get_buffer_size⚠
Length of the string
nix_realised_string_get_buffer_start⚠
Start of the string
nix_realised_string_get_store_path⚠
Get a store path. The store paths are stored in an arbitrary order.
nix_realised_string_get_store_path_count⚠
Number of realised store paths
nix_register_primop⚠
add a primop to the builtins attribute set @ingroup primops
nix_set_err_msg⚠
Set an error message on a nix context.
nix_set_log_format⚠
Sets the log format
nix_set_string_return⚠
Sets the contents of a nix_string_return
nix_set_verbosity⚠
Sets the verbosity level
nix_setting_get⚠
@defgroup settings Nix configuration settings Retrieves a setting from the nix global configuration.
nix_setting_set⚠
Sets a setting in the nix global configuration.
nix_state_create⚠
Create a new Nix language evaluator state @ingroup libexpr_init
nix_state_free⚠
Frees a Nix state. @ingroup libexpr_init
nix_store_add_bytes_to_store⚠
Add raw bytes to the store as a flat, content-addressed file.
nix_store_add_temp_root⚠
Register a store path as a temporary GC root.
nix_store_copy_closure⚠
Copy the closure of path from srcStore to dstStore.
nix_store_copy_path⚠
Copy a path from one store to another.
nix_store_create_from_parts⚠
Create a StorePath from its constituent parts (hash and name)
nix_store_drv_from_store_path⚠
Returns the derivation associated with the store path
nix_store_free⚠
Deallocate a nix store and free any resources if not also held by other Store instances.
nix_store_get_fs_closure⚠
Gets the closure of a specific store path
nix_store_get_storedir⚠
get the storeDir of a Nix store, typically "/nix/store"
nix_store_get_uri⚠
get the URI of a nix store
nix_store_get_version⚠
get the version of a nix store.
nix_store_is_valid_path⚠
Check if a StorePath is valid (i.e. that corresponding store object and its closure of references exists in the store)
nix_store_open⚠
Open a nix store.
nix_store_parse_path⚠
Parse a Nix store path that includes the store dir into a StorePath
nix_store_path_clone⚠
Copy a StorePath
nix_store_path_free⚠
Deallocate a StorePath
nix_store_path_hash⚠
Get the path hash (e.g. “” in /nix/store/-)
nix_store_path_name⚠
Get the path name (e.g. “” in /nix/store/-)
nix_store_path_to_string⚠
Render a StorePath as its canonical /nix/store/… string.
nix_store_query_path_from_hash_part⚠
Query the full store path given the hash part of a valid store path, or empty if no matching path is found.
nix_store_real_path⚠
Get the physical location of a store path
nix_store_realise⚠
Realise a Nix store path
nix_string_realise⚠
Realise a string context.
nix_value_auto_call_function⚠
Call a function, drawing its arguments from an attribute set.
nix_value_call⚠
Calls a Nix function with an argument. @ingroup value_create
nix_value_call_multi⚠
Calls a Nix function with multiple arguments. @ingroup value_create
nix_value_decref⚠
Decrement the garbage collector reference counter for the given object @ingroup value
nix_value_force⚠
Forces the evaluation of a Nix value. @ingroup value_create
nix_value_force_deep⚠
Forces the deep evaluation of a Nix value.
nix_value_incref⚠
Increment the garbage collector reference counter for the given nix_value. @ingroup value
nix_version_get⚠
Retrieves the nix library version.

Type Aliases§

PrimOpFun
Function pointer for primops @ingroup primops
Value
Deprecated Use nix_value instead
ValueType
Represents the state of a Nix value
nix_err
Type for error codes in the Nix system
nix_get_string_callback
Called to get the value of a string owned by Nix.
nix_verbosity
Verbosity level