C bindings for nix libstore.
More...
|
typedef struct Store | Store |
| reference to a nix store
|
|
typedef struct StorePath | StorePath |
| nix store path
|
|
|
nix_err | nix_libstore_init (nix_c_context *context) |
| Initializes the Nix store library. More...
|
|
nix_err | nix_init_plugins (nix_c_context *context) |
| Loads plugins specified in the settings. More...
|
|
Store * | nix_store_open (nix_c_context *, const char *uri, const char ***params) |
| Open a nix store. More...
|
|
void | nix_store_unref (Store *store) |
| Unref a nix store. More...
|
|
nix_err | nix_store_get_uri (nix_c_context *context, Store *store, char *dest, unsigned int n) |
| get the URI of a nix store More...
|
|
StorePath * | nix_store_parse_path (nix_c_context *context, Store *store, const char *path) |
| parse a nix store path into a StorePath More...
|
|
void | nix_store_path_free (StorePath *p) |
| Deallocate a nix StorePath. More...
|
|
bool | nix_store_is_valid_path (nix_c_context *context, Store *store, StorePath *path) |
| check if a storepath is valid (exists in the store) More...
|
|
nix_err | nix_store_build (nix_c_context *context, Store *store, StorePath *path, void *userdata, void(*cb)(void *userdata, const char *outname, const char *out)) |
| Build a nix store path. More...
|
|
nix_err | nix_store_get_version (nix_c_context *, Store *store, char *dest, unsigned int n) |
| get the version of a nix store More...
|
|
C bindings for nix libstore.
libstore is used for talking to a Nix store
◆ nix_init_plugins()
Loads plugins specified in the settings.
Call this once, after calling your desired init functions and setting relevant settings.
- Parameters
-
[out] | context | Optional, stores error information |
- Returns
- NIX_OK if the initialization was successful, an error code otherwise.
◆ nix_libstore_init()
Initializes the Nix store library.
This function should be called before creating a Store This function can be called multiple times.
- Parameters
-
[out] | context | Optional, stores error information |
- Returns
- NIX_OK if the initialization was successful, an error code otherwise.
◆ nix_store_build()
Build a nix store path.
Blocking, calls cb once for each built output
- Parameters
-
[out] | context | Optional, stores error information |
[in] | store | nix store reference |
[in] | path | Path to build |
[in] | userdata | data to pass to every callback invocation |
[in] | cb | called for every built output |
◆ nix_store_get_uri()
get the URI of a nix store
- Parameters
-
[out] | context | Optional, stores error information |
[in] | store | nix store reference |
[out] | dest | The allocated area to write the string to. |
[in] | n | Maximum size of the returned string. |
- Returns
- error code, NIX_OK on success.
◆ nix_store_get_version()
get the version of a nix store
- Parameters
-
[out] | context | Optional, stores error information |
[in] | store | nix store reference |
[out] | dest | The allocated area to write the string to. |
[in] | n | Maximum size of the returned string. |
- Returns
- error code, NIX_OK on success.
◆ nix_store_is_valid_path()
check if a storepath is valid (exists in the store)
- Parameters
-
[out] | context | Optional, stores error information |
[in] | store | nix store reference |
[in] | path | Path to check |
- Returns
- true or false, error info in context
◆ nix_store_open()
Open a nix store.
- Parameters
-
[out] | context | Optional, stores error information |
[in] | uri | URI of the nix store, copied |
[in] | params | optional, array of key-value pairs, {{"endpoint", "https://s3.local"}} |
- Returns
- ref-counted Store pointer, NULL in case of errors
- See also
- nix_store_unref
◆ nix_store_parse_path()
parse a nix store path into a StorePath
Don't forget to free this path using nix_store_path_free
- Parameters
-
[out] | context | Optional, stores error information |
[in] | store | nix store reference |
[in] | path | Path string to parse, copied |
- Returns
- owned store path, NULL on error
◆ nix_store_path_free()
Deallocate a nix StorePath.
Does not fail.
- Parameters
-
◆ nix_store_unref()
void nix_store_unref |
( |
Store * |
store | ) |
|
Unref a nix store.
Does not fail. It'll be closed and deallocated when all references are gone.
- Parameters
-
[in] | builder | the store to unref |