Expand description
Raw bindings to Nix C API
This crate contains automatically generated bindings from the Nix C headers. The bindings are generated by bindgen and include C-style naming conventions and documentation comments that don’t always conform to Rust standards.
Normally you don’t have to use this crate directly.
Instead use nix-expr.
Structs§
- Bindings
Builder - Eval
State - External
Value - List
Builder - PrimOp
- Store
Path - __
fsid_ t - derivation
- eval_
state_ builder - max_
align_ t - realised_
string - store_
path_ hash_ part - @brief A store path hash
- value
Constants§
- INT8_
MAX - INT8_
MIN - INT8_
WIDTH - INT16_
MAX - INT16_
MIN - INT16_
WIDTH - INT32_
MAX - INT32_
MIN - INT32_
WIDTH - INT64_
WIDTH - INTMAX_
WIDTH - INTPTR_
MAX - INTPTR_
MIN - INTPTR_
WIDTH - INT_
FAST8_ MAX - INT_
FAST8_ MIN - INT_
FAST8_ WIDTH - INT_
FAST16_ MAX - INT_
FAST16_ MIN - INT_
FAST16_ WIDTH - INT_
FAST32_ MAX - INT_
FAST32_ MIN - INT_
FAST32_ WIDTH - INT_
FAST64_ WIDTH - INT_
LEAS T8_ MAX - INT_
LEAS T8_ MIN - INT_
LEAS T8_ WIDTH - INT_
LEAS T16_ MAX - INT_
LEAS T16_ MIN - INT_
LEAS T16_ WIDTH - INT_
LEAS T32_ MAX - INT_
LEAS T32_ MIN - INT_
LEAS T32_ WIDTH - INT_
LEAS T64_ WIDTH - PTRDIFF_
MAX - PTRDIFF_
MIN - PTRDIFF_
WIDTH - SIG_
ATOMIC_ MAX - SIG_
ATOMIC_ MIN - SIG_
ATOMIC_ WIDTH - SIZE_
MAX - SIZE_
WIDTH - UINT8_
MAX - UINT8_
WIDTH - UINT16_
MAX - UINT16_
WIDTH - UINT32_
MAX - UINT32_
WIDTH - UINT64_
WIDTH - UINTMAX_
WIDTH - UINTPTR_
MAX - UINTPTR_
WIDTH - UINT_
FAST8_ MAX - UINT_
FAST8_ WIDTH - UINT_
FAST16_ MAX - UINT_
FAST16_ WIDTH - UINT_
FAST32_ MAX - UINT_
FAST32_ WIDTH - UINT_
FAST64_ WIDTH - UINT_
LEAS T8_ MAX - UINT_
LEAS T8_ WIDTH - UINT_
LEAS T16_ MAX - UINT_
LEAS T16_ WIDTH - UINT_
LEAS T32_ MAX - UINT_
LEAS T32_ WIDTH - UINT_
LEAS T64_ WIDTH - Value
Type_ NIX_ TYPE_ ATTRS - @brief Attribute set (key-value mapping) @see https://nix.dev/manual/nix/latest/language/types.html#type-attrs
- Value
Type_ NIX_ TYPE_ BOOL - @brief Boolean true or false value @see https://nix.dev/manual/nix/latest/language/types.html#type-bool
- Value
Type_ NIX_ TYPE_ EXTERNAL - @brief External value from C++ plugins or C API @see Externals
- Value
Type_ NIX_ TYPE_ FLOAT - @brief IEEE 754 double precision floating point number @see https://nix.dev/manual/nix/latest/language/types.html#type-float
- Value
Type_ NIX_ TYPE_ FUNCTION - @brief Function (lambda or builtin) @see https://nix.dev/manual/nix/latest/language/types.html#type-function
- Value
Type_ NIX_ TYPE_ INT - A 64 bit signed integer.
- Value
Type_ NIX_ TYPE_ LIST - @brief Ordered list of values @see https://nix.dev/manual/nix/latest/language/types.html#type-list
- Value
Type_ NIX_ TYPE_ NULL - @brief Null value @see https://nix.dev/manual/nix/latest/language/types.html#type-null
- Value
Type_ NIX_ TYPE_ PATH - @brief Filesystem path @see https://nix.dev/manual/nix/latest/language/types.html#type-path
- Value
Type_ NIX_ TYPE_ STRING - @brief String value with context
- Value
Type_ NIX_ TYPE_ THUNK - Unevaluated expression
- WCHAR_
WIDTH - WINT_
MAX - WINT_
MIN - WINT_
WIDTH - _ATFILE_
SOURCE - _BITS_
STDINT_ INTN_ H - _BITS_
STDINT_ LEAST_ H - _BITS_
STDINT_ UINTN_ H - _BITS_
TIME64_ H - _BITS_
TYPESIZES_ H - _BITS_
TYPES_ H - _BITS_
WCHAR_ H - _DEFAULT_
SOURCE - _DYNAMIC_
STACK_ SIZE_ SOURCE - _FEATURES_
H - _ISO
C2Y_ SOURCE - _ISO
C11_ SOURCE - _ISO
C23_ SOURCE - _ISO
C95_ SOURCE - _ISO
C99_ SOURCE - _LARGEFIL
E64_ SOURCE - _LARGEFILE_
SOURCE - _POSIX_
C_ SOURCE - _POSIX_
SOURCE - _STDC_
PREDEF_ H - _STDINT_
H - _SYS_
CDEFS_ H - _XOPEN_
SOURCE - _XOPEN_
SOURCE_ EXTENDED - __
FD_ SETSIZE - __
GLIBC_ MINOR__ - __
GLIBC_ USE_ C23_ STRTOL - __
GLIBC_ USE_ DEPRECATED_ GETS - __
GLIBC_ USE_ DEPRECATED_ SCANF - __
GLIBC_ USE_ IEC_ 60559_ BFP_ EXT - __
GLIBC_ USE_ IEC_ 60559_ BFP_ EXT_ C23 - __
GLIBC_ USE_ IEC_ 60559_ EXT - __
GLIBC_ USE_ IEC_ 60559_ FUNCS_ EXT - __
GLIBC_ USE_ IEC_ 60559_ FUNCS_ EXT_ C23 - __
GLIBC_ USE_ IEC_ 60559_ TYPES_ EXT - __
GLIBC_ USE_ ISOC2Y - __
GLIBC_ USE_ ISOC23 - __
GLIBC_ USE_ LIB_ EXT2 - __
GLIBC__ - __
GNU_ LIBRARY__ - __
HAVE_ GENERIC_ SELECTION - __
INO_ T_ MATCHES_ INO64_ T - __
KERNEL_ OLD_ TIMEVAL_ MATCHES_ TIMEVA L64 - __
LDOUBLE_ REDIRECTS_ TO_ FLOA T128_ ABI - __
OFF_ T_ MATCHES_ OFF64_ T - __
RLIM_ T_ MATCHES_ RLIM64_ T - __
STATFS_ MATCHES_ STATF S64 - __
STDC_ IEC_ 559_ COMPLEX__ - __
STDC_ IEC_ 559__ - __
STDC_ IEC_ 60559_ BFP__ - __
STDC_ IEC_ 60559_ COMPLEX__ - __
STDC_ ISO_ 10646__ - __
SYSCALL_ WORDSIZE - __
TIMESIZE - __
USE_ ATFILE - __
USE_ DYNAMIC_ STACK_ SIZE - __
USE_ FORTIFY_ LEVEL - __
USE_ GNU - __
USE_ ISOC11 - __
USE_ ISOC95 - __
USE_ ISOC99 - __
USE_ ISOCX X11 - __
USE_ LARGEFILE - __
USE_ LARGEFIL E64 - __
USE_ MISC - __
USE_ POSIX - __
USE_ POSI X2 - __
USE_ POSI X199309 - __
USE_ POSI X199506 - __
USE_ TIME_ BITS64 - __
USE_ UNIX98 - __
USE_ XOPEN - __
USE_ XOPE N2K - __
USE_ XOPE N2K8 - __
USE_ XOPE N2K8XSI - __
USE_ XOPE N2KXSI - __
USE_ XOPEN_ EXTENDED - __
WORDSIZE - __
WORDSIZE_ TIME64_ COMPA T32 - __
bool_ true_ false_ are_ defined - __
glibc_ c99_ flexarr_ available
Functions§
- alloc_
primop ⚠ - @brief Allocate a PrimOp @ingroup primops
- alloc_
value ⚠ - @brief Allocate a Nix value @ingroup value_create
- bindings_
builder_ ⚠free - @brief Free a bindings builder
- bindings_
builder_ ⚠insert - @brief Insert bindings into a builder @param[out] context Optional, stores error information @param[in] builder BindingsBuilder to insert into @param[in] name attribute name, only used for the duration of the call. @param[in] value value to give the binding @return error code, NIX_OK on success.
- copy_
value ⚠ - @brief Copy from another value @ingroup value_create @param[out] context Optional, stores error information @param[out] value Nix value to modify @param[in] source value to copy from @return error code, NIX_OK on success.
- derivation_
clone ⚠ - @brief Copy a
nix_derivation - derivation_
free ⚠ - @brief Deallocate a
nix_derivation - derivation_
to_ ⚠json - @brief Gets the derivation as a JSON string
- eval_
state_ ⚠build - @brief Create a new Nix language evaluator state @ingroup libexpr_init
- eval_
state_ ⚠builder_ free - @brief Free a nix_eval_state_builder @ingroup libexpr_init
- eval_
state_ ⚠builder_ load - @brief Read settings from the ambient environment @ingroup libexpr_init
- eval_
state_ ⚠builder_ new - @brief Create a new nix_eval_state_builder @ingroup libexpr_init
- eval_
state_ ⚠builder_ set_ lookup_ path - @brief Set the lookup path for
<...>expressions @ingroup libexpr_init - expr_
eval_ ⚠from_ string - @brief Parses and evaluates a Nix expression from a string. @ingroup value_create
- gc_
decref ⚠ - @brief Decrement the garbage collector reference counter for the given object
- gc_
incref ⚠ - @brief Increment the garbage collector reference counter for the given object.
- gc_now⚠
- @brief Trigger the garbage collector manually
- gc_
register_ ⚠finalizer - @brief Register a callback that gets called when the object is garbage collected. @note Objects can only have a single finalizer. This function overwrites existing values silently. @param[in] obj the object to watch @param[in] cd the data to pass to the finalizer @param[in] finalizer the callback function, called with obj and cd
- get_
attr_ ⚠byidx - @brief Get an attribute by index @ingroup value_extract
- get_
attr_ ⚠byidx_ lazy - @brief Get an attribute by index, without forcing evaluation of the attribute’s value @ingroup value_extract
- get_
attr_ ⚠byname - @brief Get an attr by name @ingroup value_extract
- get_
attr_ ⚠byname_ lazy - @brief Get an attribute value by attribute name, without forcing evaluation of the attribute’s value @ingroup value_extract
- get_
attr_ ⚠name_ byidx - @brief Get an attribute name by index @ingroup value_extract
- get_
attrs_ ⚠size - @brief Get the element count of an attrset @ingroup value_extract @param[out] context Optional, stores error information @param[in] value Nix value to inspect @return attrset element count, error info via context
- get_
bool ⚠ - @brief Get boolean value @ingroup value_extract @param[out] context Optional, stores error information @param[in] value Nix value to inspect @return true or false, error info via context
- get_
external ⚠ - @brief Get external reference @ingroup value_extract @param[out] context Optional, stores error information @param[in] value Nix value to inspect @return reference valid while value is valid. Call nix_gc_incref() if you need it to live longer, then only in that case call nix_gc_decref() when done. NULL in case of error
- get_
float ⚠ - @brief Get float value in 64 bits @ingroup value_extract @param[out] context Optional, stores error information @param[in] value Nix value to inspect @return float contents, error info via context
- get_int⚠
- @brief Get int value @ingroup value_extract @param[out] context Optional, stores error information @param[in] value Nix value to inspect @return int contents, error info via context
- get_
list_ ⚠byidx - @brief Get the ix’th element of a list @ingroup value_extract
- get_
list_ ⚠byidx_ lazy - @brief Get the ix’th element of a list without forcing evaluation of the element @ingroup value_extract
- get_
list_ ⚠size - @brief Get the length of a list @ingroup value_extract @param[out] context Optional, stores error information @param[in] value Nix value to inspect @return length of list, error info via context
- get_
path_ ⚠string - @brief Get path as string @ingroup value_extract @param[out] context Optional, stores error information @param[in] value Nix value to inspect @return string valid while value is valid, NULL in case of error
- get_
string ⚠ - @brief Get the raw string @ingroup value_extract
- get_
type ⚠ - @brief Get value type @ingroup value_extract @param[out] context Optional, stores error information @param[in] value Nix value to inspect @return type of nix value
- get_
typename ⚠ - @brief Get type name of value as defined in the evaluator @ingroup value_extract @param[out] context Optional, stores error information @param[in] value Nix value to inspect @return type name string, free with free()
- has_
attr_ ⚠byname - @brief Check if an attribute name exists on a value @ingroup value_extract @param[out] context Optional, stores error information @param[in] value Nix value to inspect @param[in] state nix evaluator state @param[in] name attribute name @return value, error info via context
- init_
apply ⚠ - @brief Set the value to a thunk that will perform a function application when needed. @ingroup value_create
- init_
bool ⚠ - @name Initializers
- init_
external ⚠ - @brief Set an external value @ingroup value_create @param[out] context Optional, stores error information @param[out] value Nix value to modify @param[in] val the external value to set. Will be GC-referenced by the value. @return error code, NIX_OK on success.
- init_
float ⚠ - @brief Set a float @ingroup value_create @param[out] context Optional, stores error information @param[out] value Nix value to modify @param[in] d the float, 64-bits @return error code, NIX_OK on success.
- init_
int ⚠ - @brief Set an int @ingroup value_create @param[out] context Optional, stores error information @param[out] value Nix value to modify @param[in] i the int @return error code, NIX_OK on success.
- init_
null ⚠ - @brief Set null @ingroup value_create @param[out] context Optional, stores error information @param[out] value Nix value to modify @return error code, NIX_OK on success.
- init_
path_ ⚠string - @brief Set a path @ingroup value_create @param[out] context Optional, stores error information @param[out] value Nix value to modify @param[in] str the path string, copied @return error code, NIX_OK on success.
- init_
primop ⚠ - @brief Set primop @ingroup value_create @param[out] context Optional, stores error information @param[out] value Nix value to modify @param[in] op primop, will be gc-referenced by the value @see nix_alloc_primop @return error code, NIX_OK on success.
- init_
string ⚠ - @brief Set a string @ingroup value_create @param[out] context Optional, stores error information @param[out] value Nix value to modify @param[in] str the string, copied @return error code, NIX_OK on success.
- libexpr_
init ⚠ - @brief Initialize the Nix language evaluator. @ingroup libexpr_init
- list_
builder_ ⚠free - @brief Free a list builder
- list_
builder_ ⚠insert - @brief Insert bindings into a builder @param[out] context Optional, stores error information @param[in] list_builder ListBuilder to insert into @param[in] index index to manipulate @param[in] value value to insert @return error code, NIX_OK on success.
- make_
attrs ⚠ - @brief Create an attribute set from a bindings builder @ingroup value_create
- make_
bindings_ ⚠builder - @brief Create a bindings builder @param[out] context Optional, stores error information @param[in] state nix evaluator state @param[in] capacity how many bindings you’ll add. Don’t exceed. @return bindings builder. Call nix_bindings_builder_free() when you’re done.
- make_
list ⚠ - @brief Create a list from a list builder @ingroup value_create
- make_
list_ ⚠builder - @brief Create a list builder @ingroup value_create @param[out] context Optional, stores error information @param[in] state nix evaluator state @param[in] capacity how many bindings you’ll add. Don’t exceed. @return list builder. Call nix_list_builder_free() when you’re done.
- realised_
string_ ⚠free - @brief Free a realised string @param[in] realised_string
- realised_
string_ ⚠get_ buffer_ size - @brief Length of the string @param[in] realised_string @return length of the string in bytes
- realised_
string_ ⚠get_ buffer_ start - @brief Start of the string @param[in] realised_string @return pointer to the start of the string, valid until realised_string is freed. It may not be null-terminated.
- realised_
string_ ⚠get_ store_ path - @brief Get a store path. The store paths are stored in an arbitrary order. @param[in] realised_string @param[in] index index of the store path, must be less than the count @return store path valid until realised_string is freed
- realised_
string_ ⚠get_ store_ path_ count - @brief Number of realised store paths @param[in] realised_string @return number of realised store paths that were referenced by the string via its context
- register_
primop ⚠ - @brief add a primop to the
builtinsattribute set @ingroup primops - state_
create ⚠ - @brief Create a new Nix language evaluator state @ingroup libexpr_init
- state_
free ⚠ - @brief Frees a Nix state. @ingroup libexpr_init
- store_
create_ ⚠from_ parts - @brief Create a StorePath from its constituent parts (hash and name)
- store_
path_ ⚠clone - @brief Copy a StorePath
- store_
path_ ⚠free - @brief Deallocate a StorePath
- store_
path_ ⚠hash - @brief Get the path hash (e.g. “
” in /nix/store/ - ) - store_
path_ ⚠name - @brief Get the path name (e.g. “
” in /nix/store/ - ) - string_
realise ⚠ - @brief Realise a string context.
- value_
call ⚠ - @brief Calls a Nix function with an argument. @ingroup value_create
- value_
call_ ⚠multi - @brief Calls a Nix function with multiple arguments. @ingroup value_create
- value_
decref ⚠ - @brief Decrement the garbage collector reference counter for the given object @ingroup value
- value_
force ⚠ - @brief Forces the evaluation of a Nix value. @ingroup value_create
- value_
force_ ⚠deep - @brief Forces the deep evaluation of a Nix value.
- value_
incref ⚠ - @brief Increment the garbage collector reference counter for the given
nix_value. @ingroup value
Type Aliases§
- Prim
OpFun - @brief Function pointer for primops @ingroup primops
- Value
- @deprecated Use nix_value instead
- Value
Type - @brief Represents the state of a Nix value
- __
blkcnt64_ t - __
blkcnt_ t - __
blksize_ t - __
caddr_ t - __
clock_ t - __
clockid_ t - __
daddr_ t - __dev_t
- __
fsblkcnt64_ t - __
fsblkcnt_ t - __
fsfilcnt64_ t - __
fsfilcnt_ t - __
fsword_ t - __gid_t
- __id_t
- __
ino64_ t - __ino_t
- __
int8_ t - __
int16_ t - __
int32_ t - __
int64_ t - __
int_ least8_ t - __
int_ least16_ t - __
int_ least32_ t - __
int_ least64_ t - __
intmax_ t - __
intptr_ t - __key_t
- __
loff_ t - __
mode_ t - __
nlink_ t - __
off64_ t - __off_t
- __pid_t
- __
quad_ t - __
rlim64_ t - __
rlim_ t - __
sig_ atomic_ t - __
socklen_ t - __
ssize_ t - __
suseconds64_ t - __
suseconds_ t - __
syscall_ slong_ t - __
syscall_ ulong_ t - __
time_ t - __
timer_ t - __
u_ char - __u_int
- __
u_ long - __
u_ quad_ t - __
u_ short - __uid_t
- __
uint8_ t - __
uint16_ t - __
uint32_ t - __
uint64_ t - __
uint_ least8_ t - __
uint_ least16_ t - __
uint_ least32_ t - __
uint_ least64_ t - __
uintmax_ t - __
useconds_ t - int_
fast8_ t - int_
fast16_ t - int_
fast32_ t - int_
fast64_ t - int_
least8_ t - int_
least16_ t - int_
least32_ t - int_
least64_ t - intmax_
t - uint_
fast8_ t - uint_
fast16_ t - uint_
fast32_ t - uint_
fast64_ t - uint_
least8_ t - uint_
least16_ t - uint_
least32_ t - uint_
least64_ t - uintmax_
t