feat(tvix/eval): teach builtins.toXML context
XmlEmitter gains a NixContext field, and `write_typed_value` extends it with all context elements present in the passed value. Once all serialization is done, a into_context() function returns the collected context, so we can construct a NixString with context. Tests for this live in tvix-glue, as we use builtins.derivation, which is not present in the tvix-eval crate. Fixes b/398. Change-Id: I85feaaa17b753885f8a017a54e419ec4e602af21 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11704 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de> Autosubmit: flokli <flokli@flokli.de> Reviewed-by: Alyssa Ross <hi@alyssa.is>
This commit is contained in:
parent
a4a313cdd2
commit
ec8d79f3db
4 changed files with 53 additions and 6 deletions
|
|
@ -0,0 +1 @@
|
|||
[ { "/nix/store/y1s2fiq89v2h9vkb38w508ir20dwv6v2-test.drv" = { allOutputs = true; }; } false ]
|
||||
14
tvix/glue/src/tests/tvix_tests/eval-okay-toxml-context.nix
Normal file
14
tvix/glue/src/tests/tvix_tests/eval-okay-toxml-context.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[
|
||||
# builtins.toXML retains context where there is.
|
||||
(builtins.getContext (builtins.toXML {
|
||||
inherit (derivation {
|
||||
name = "test";
|
||||
builder = "/bin/sh";
|
||||
system = builtins.currentSystem;
|
||||
}) drvPath;
|
||||
}))
|
||||
|
||||
# this should have no context.
|
||||
(builtins.hasContext
|
||||
(builtins.toXML { }))
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue