1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 14:51:16 +02:00

C API: Add nix_init_apply

Thunks are relevant when initializing attrsets and lists, passing
arguments. This is an important way to produce them.
This commit is contained in:
Robert Hensing 2024-04-17 17:41:23 +02:00
parent 05b9dac754
commit ad643cde58
4 changed files with 157 additions and 2 deletions

View file

@ -404,6 +404,19 @@ nix_err nix_init_null(nix_c_context * context, Value * value)
NIXC_CATCH_ERRS
}
nix_err nix_init_apply(nix_c_context * context, Value * value, Value * fn, Value * arg)
{
if (context)
context->last_err_code = NIX_OK;
try {
auto & v = check_value_not_null(value);
auto & f = check_value_not_null(fn);
auto & a = check_value_not_null(arg);
v.mkApp(&f, &a);
}
NIXC_CATCH_ERRS
}
nix_err nix_init_external(nix_c_context * context, Value * value, ExternalValue * val)
{
if (context)