Nix 2.34.6
Nix, the purely functional package manager: C API (experimental)
Loading...
Searching...
No Matches
nix_api_store.h
Go to the documentation of this file.
1#ifndef NIX_API_STORE_H
2#define NIX_API_STORE_H
13
14#include "nix_api_util.h"
15#include "nix_api_store/store_path.h"
16#include "nix_api_store/derivation.h"
17#include <stdbool.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22// cffi start
23
25typedef struct Store Store;
26
37
44
74Store * nix_store_open(nix_c_context * context, const char * uri, const char *** params);
75
83void nix_store_free(Store * store);
84
94nix_err nix_store_get_uri(nix_c_context * context, Store * store, nix_get_string_callback callback, void * user_data);
95
106nix_store_get_storedir(nix_c_context * context, Store * store, nix_get_string_callback callback, void * user_data);
107
117StorePath * nix_store_parse_path(nix_c_context * context, Store * store, const char * path);
118
127bool nix_store_is_valid_path(nix_c_context * context, Store * store, const StorePath * path);
128
146 nix_c_context * context, Store * store, StorePath * path, nix_get_string_callback callback, void * user_data);
147
148// nix_err nix_store_ensure(Store*, const char*);
149// nix_err nix_store_build_paths(Store*);
167 nix_c_context * context,
168 Store * store,
169 StorePath * path,
170 void * userdata,
171 void (*callback)(void * userdata, const char * outname, const StorePath * out));
172
186nix_store_get_version(nix_c_context * context, Store * store, nix_get_string_callback callback, void * user_data);
187
202nix_derivation * nix_derivation_from_json(nix_c_context * context, Store * store, const char * json);
203
211StorePath * nix_add_derivation(nix_c_context * context, Store * store, nix_derivation * derivation);
212
221nix_err nix_store_copy_closure(nix_c_context * context, Store * srcStore, Store * dstStore, StorePath * path);
222
243 nix_c_context * context,
244 Store * store,
245 const StorePath * store_path,
246 bool flip_direction,
247 bool include_outputs,
248 bool include_derivers,
249 void * userdata,
250 void (*callback)(nix_c_context * context, void * userdata, const StorePath * store_path));
251
260nix_derivation * nix_store_drv_from_store_path(nix_c_context * context, Store * store, const StorePath * path);
261
271StorePath * nix_store_query_path_from_hash_part(nix_c_context * context, Store * store, const char * hash);
272
284 nix_c_context * context, Store * srcStore, Store * dstStore, const StorePath * path, bool repair, bool checkSigs);
285
286// cffi end
287#ifdef __cplusplus
288}
289#endif
293#endif // NIX_API_STORE_H
void(* nix_get_string_callback)(const char *start, unsigned int n, void *user_data)
Called to get the value of a string owned by Nix.
Definition nix_api_util.h:171
nix_err
Type for error codes in the Nix system.
Definition nix_api_util.h:59
void nix_store_free(Store *store)
Deallocate a nix store and free any resources if not also held by other Store instances.
nix_err nix_store_copy_closure(nix_c_context *context, Store *srcStore, Store *dstStore, StorePath *path)
Copy the closure of path from srcStore to dstStore.
nix_err nix_store_get_storedir(nix_c_context *context, Store *store, nix_get_string_callback callback, void *user_data)
get the storeDir of a Nix store, typically "/nix/store"
StorePath * nix_store_query_path_from_hash_part(nix_c_context *context, Store *store, const char *hash)
Query the full store path given the hash part of a valid store path, or empty if no matching path is ...
StorePath * nix_add_derivation(nix_c_context *context, Store *store, nix_derivation *derivation)
Add the given nix_derivation to the given store.
nix_err nix_libstore_init(nix_c_context *context)
Initializes the Nix store library.
struct Store Store
Reference to a Nix store.
Definition nix_api_store.h:25
nix_err nix_store_real_path(nix_c_context *context, Store *store, StorePath *path, nix_get_string_callback callback, void *user_data)
Get the physical location of a store path.
nix_err nix_libstore_init_no_load_config(nix_c_context *context)
Like nix_libstore_init, but does not load the Nix configuration.
nix_err nix_store_realise(nix_c_context *context, Store *store, StorePath *path, void *userdata, void(*callback)(void *userdata, const char *outname, const StorePath *out))
Realise a Nix store path.
nix_err nix_store_get_fs_closure(nix_c_context *context, Store *store, const StorePath *store_path, bool flip_direction, bool include_outputs, bool include_derivers, void *userdata, void(*callback)(nix_c_context *context, void *userdata, const StorePath *store_path))
Gets the closure of a specific store path.
Store * nix_store_open(nix_c_context *context, const char *uri, const char ***params)
Open a nix store.
nix_derivation * nix_store_drv_from_store_path(nix_c_context *context, Store *store, const StorePath *path)
Returns the derivation associated with the store path.
bool nix_store_is_valid_path(nix_c_context *context, Store *store, const StorePath *path)
Check if a StorePath is valid (i.e. that corresponding store object and its closure of references exi...
nix_err nix_store_get_uri(nix_c_context *context, Store *store, nix_get_string_callback callback, void *user_data)
get the URI of a nix store
nix_err nix_store_copy_path(nix_c_context *context, Store *srcStore, Store *dstStore, const StorePath *path, bool repair, bool checkSigs)
Copy a path from one store to another.
nix_derivation * nix_derivation_from_json(nix_c_context *context, Store *store, const char *json)
Create a nix_derivation from a JSON representation of that derivation.
StorePath * nix_store_parse_path(nix_c_context *context, Store *store, const char *path)
Parse a Nix store path that includes the store dir into a StorePath.
nix_err nix_store_get_version(nix_c_context *context, Store *store, nix_get_string_callback callback, void *user_data)
get the version of a nix store.
Main entry for the libutil C bindings.
This object stores error state.