libexpr/builtins: Document appendContext

Change-Id: Ic45e0d4f6f1646552a7162bd8916f63fc11e5e62
This commit is contained in:
Tom Hubrecht
2025-11-23 07:26:15 +00:00
parent be18b7dc25
commit fd273186c6
4 changed files with 9 additions and 8 deletions
+6
View File
@@ -0,0 +1,6 @@
---
name: appendContext
args: [s, ctx]
---
Appends the attribute set `ctx` as a context to the string `s`, see [`getContext`](#builtins-getContext) for details on the format of the context.
+1
View File
@@ -14,6 +14,7 @@ void prim_fetchGit(EvalState & state, Value * * args, Value & v);
void prim_fetchTarball(EvalState & state, Value * * args, Value & v);
void prim_fetchurl(EvalState & state, Value * * args, Value & v);
void prim_fromTOML(EvalState & state, Value * * args, Value & v);
void prim_appendContext(EvalState & state, Value ** args, Value & v);
void prim_getContext(EvalState & state, Value * * args, Value & v);
void prim_hasContext(EvalState & state, Value * * args, Value & v);
void prim_unsafeDiscardOutputDependency(EvalState & state, Value * * args, Value & v);
+1
View File
@@ -56,6 +56,7 @@ builtin_definitions = files(
'builtins/addErrorContext.md',
'builtins/all.md',
'builtins/any.md',
'builtins/appendContext.md',
'builtins/attrNames.md',
'builtins/attrValues.md',
'builtins/baseNameOf.md',
+1 -8
View File
@@ -165,7 +165,7 @@ void prim_getContext(EvalState & state, Value * * args, Value & v)
See the commentary above unsafeGetContext for details of the
context representation.
*/
static void prim_appendContext(EvalState & state, Value * * args, Value & v)
void prim_appendContext(EvalState & state, Value ** args, Value & v)
{
NixStringContext context;
auto orig = state.forceString(*args[0], context, noPos, "while evaluating the first argument passed to builtins.appendContext");
@@ -241,11 +241,4 @@ static void prim_appendContext(EvalState & state, Value * * args, Value & v)
v.mkString(orig, context);
}
static RegisterPrimOp primop_appendContext({
.name = "__appendContext",
.arity = 2,
.fun = prim_appendContext
});
}