From df9401eb4efd63d13392cf9081447d537e6776fa Mon Sep 17 00:00:00 2001 From: Yorick van Pelt Date: Mon, 7 Aug 2023 15:54:46 +0200 Subject: [PATCH] nix_api_store: add nix_init_plugins --- src/libstore/nix_api_store.cc | 9 +++++++++ src/libstore/nix_api_store.h | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/libstore/nix_api_store.cc b/src/libstore/nix_api_store.cc index c81ad49ee..0cc1d1983 100644 --- a/src/libstore/nix_api_store.cc +++ b/src/libstore/nix_api_store.cc @@ -20,6 +20,15 @@ nix_err nix_libstore_init(nix_c_context *context) { NIXC_CATCH_ERRS } +nix_err nix_init_plugins(nix_c_context *context) { + if (context) + context->last_err_code = NIX_OK; + try { + nix::initPlugins(); + } + NIXC_CATCH_ERRS +} + Store *nix_store_open(nix_c_context *context, const char *uri, const char ***params) { if (context) diff --git a/src/libstore/nix_api_store.h b/src/libstore/nix_api_store.h index bc01f0ad2..b15e161b3 100644 --- a/src/libstore/nix_api_store.h +++ b/src/libstore/nix_api_store.h @@ -35,6 +35,17 @@ typedef struct StorePath StorePath; */ nix_err nix_libstore_init(nix_c_context *context); +/** + * @brief Loads plugins specified in the settings + * + * Call this once, after calling your desired init functions and setting + * relevant settings. + * + * @param[out] context Optional, stores error information + * @return NIX_OK if the initialization was successful, an error code otherwise. + */ +nix_err nix_init_plugins(nix_c_context *context); + /** * @brief Open a nix store * @param[out] context Optional, stores error information