1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

init: Add flag to avoid loading configuration

This commit is contained in:
Robert Hensing 2024-04-19 23:41:56 +02:00
parent 8c4c2156bd
commit e05b58b060
6 changed files with 27 additions and 7 deletions

View file

@ -19,6 +19,16 @@ nix_err nix_libstore_init(nix_c_context * context)
NIXC_CATCH_ERRS
}
nix_err nix_libstore_init_no_load_config(nix_c_context * context)
{
if (context)
context->last_err_code = NIX_OK;
try {
nix::initLibStore(false);
}
NIXC_CATCH_ERRS
}
nix_err nix_init_plugins(nix_c_context * context)
{
if (context)

View file

@ -35,6 +35,13 @@ typedef struct StorePath StorePath;
*/
nix_err nix_libstore_init(nix_c_context * context);
/**
* @brief Like nix_libstore_init, but does not load the Nix configuration.
*
* This is useful when external configuration is not desired, such as when running unit tests.
*/
nix_err nix_libstore_init_no_load_config(nix_c_context * context);
/**
* @brief Loads the plugins specified in Nix's plugin-files setting.
*