about summary refs log tree commit diff
path: root/tvix/eval
diff options
context:
space:
mode:
authorAspen Smith <root@gws.fyi>2024-08-11T01·03-0400
committerclbot <clbot@tvl.fyi>2024-08-11T16·41+0000
commite176e1f11a00f77416aca30ec46b75259ca94e42 (patch)
tree21b4d6dd17920619437b21dcc2df424716cf84fd /tvix/eval
parenta781cfcc497fbacbe137cf38dc57859fe59ce3bc (diff)
feat(tvix/value): Print derivation values specially r/8479
Just like tvix-repl does (except we don't force values when printing
them, so... not entirely like tvix-repl does). But it's something.

Change-Id: I2e69b08d7d82b0b2d337f1d4c5d87ed28475fa84
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12180
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Autosubmit: aspen <root@gws.fyi>
Diffstat (limited to 'tvix/eval')
-rw-r--r--tvix/eval/src/value/attrs.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tvix/eval/src/value/attrs.rs b/tvix/eval/src/value/attrs.rs
index 33259c8058eb..128e44a18b59 100644
--- a/tvix/eval/src/value/attrs.rs
+++ b/tvix/eval/src/value/attrs.rs
@@ -118,6 +118,18 @@ where
 
 impl TotalDisplay for NixAttrs {
     fn total_fmt(&self, f: &mut std::fmt::Formatter<'_>, set: &mut ThunkSet) -> std::fmt::Result {
+        if let Some(Value::String(s)) = self.select("type") {
+            if *s == "derivation" {
+                write!(f, "«derivation ")?;
+                if let Some(p) = self.select("drvPath") {
+                    p.total_fmt(f, set)?;
+                } else {
+                    write!(f, "???")?;
+                }
+                return write!(f, "»");
+            }
+        }
+
         f.write_str("{ ")?;
 
         match &self.0 {