From e176e1f11a00f77416aca30ec46b75259ca94e42 Mon Sep 17 00:00:00 2001 From: Aspen Smith Date: Sat, 10 Aug 2024 21:03:51 -0400 Subject: feat(tvix/value): Print derivation values specially 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 Tested-by: BuildkiteCI Autosubmit: aspen --- tvix/eval/src/value/attrs.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tvix/eval') 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 { -- cgit 1.4.1