1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 15:32:43 +01:00

C API: clarify some documentation

This commit is contained in:
Yorick van Pelt 2023-08-28 16:42:59 +02:00 committed by José Luis Lafuente
parent 5d82d6e733
commit 9d380c0f76
No known key found for this signature in database
GPG key ID: 8A3455EBE455489A
5 changed files with 22 additions and 19 deletions

View file

@ -103,7 +103,7 @@ StorePath *nix_store_parse_path(nix_c_context *context, Store *store,
nix_err nix_store_build(nix_c_context *context, Store *store, StorePath *path,
void *userdata,
void (*iter)(void *userdata, const char *,
void (*callback)(void *userdata, const char *,
const char *)) {
if (context)
context->last_err_code = NIX_OK;
@ -114,11 +114,11 @@ nix_err nix_store_build(nix_c_context *context, Store *store, StorePath *path,
.outputs = nix::OutputsSpec::All{},
},
});
if (iter) {
if (callback) {
for (auto &[outputName, outputPath] :
store->ptr->queryDerivationOutputMap(path->path)) {
auto op = store->ptr->printStorePath(outputPath);
iter(userdata, outputName.c_str(), op.c_str());
callback(userdata, outputName.c_str(), op.c_str());
}
}
}

View file

@ -36,7 +36,7 @@ typedef struct StorePath StorePath;
nix_err nix_libstore_init(nix_c_context *context);
/**
* @brief Loads plugins specified in the settings
* @brief Loads the plugins specified in Nix's plugin-files setting.
*
* Call this once, after calling your desired init functions and setting
* relevant settings.
@ -111,17 +111,17 @@ bool nix_store_is_valid_path(nix_c_context *context, Store *store,
/**
* @brief Realise a Nix store path
*
* Blocking, calls cb once for each built output
* Blocking, calls callback once for each realisedoutput
*
* @param[out] context Optional, stores error information
* @param[in] store Nix Store reference
* @param[in] path Path to build
* @param[in] userdata data to pass to every callback invocation
* @param[in] cb called for every built output
* @param[in] callback called for every realised output
*/
nix_err nix_store_build(nix_c_context *context, Store *store, StorePath *path,
void *userdata,
void (*cb)(void *userdata, const char *outname,
void (*callback)(void *userdata, const char *outname,
const char *out));
/**

View file

@ -1156,9 +1156,10 @@ public:
this, {}, "plugin-files",
R"(
A list of plugin files to be loaded by Nix. Each of these files will
be dlopened by Nix, allowing them to affect execution through static
initialization. In particular, these plugins may construct static
instances of RegisterPrimOp to add new primops or constants to the
be dlopened by Nix. If they contain the symbol `nix_plugin_entry()`,
this symbol will be called. Alternatively, they can affect execution
through static initialization. In particular, these plugins may construct
static instances of RegisterPrimOp to add new primops or constants to the
expression language, RegisterStoreImplementation to add new store
implementations, RegisterCommand to add new subcommands to the `nix`
command, and RegisterSetting to add new nix config settings. See the