From 947a56c4b6c5d5ed4f25f229f5de6afde564bbf9 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Mon, 12 Dec 2022 21:33:08 +0300 Subject: feat(tvix/eval): builtins.storeDir Returns the store directory through EvalIO::store_dir. Note that this is _optional_ in Tvix, as an evaluation can occur in a context where there simply is no store directory. In those contexts, `builtins.storeDir` returns `null` in Tvix. This would only happen in contexts like Tvixbolt (or completely unrelated use-cases) in practice. Co-Authored-By: Vincent Ambo Change-Id: I5a752c7e89b2f75bd7efb082dbfa5b25e3b1ff3b Reviewed-on: https://cl.tvl.fyi/c/depot/+/7452 Autosubmit: Adam Joseph Tested-by: BuildkiteCI Reviewed-by: grfn --- tvix/eval/src/io.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tvix/eval/src/io.rs') diff --git a/tvix/eval/src/io.rs b/tvix/eval/src/io.rs index 3215e5a7ddb7..4e7404ef9c53 100644 --- a/tvix/eval/src/io.rs +++ b/tvix/eval/src/io.rs @@ -41,6 +41,12 @@ pub trait EvalIO { /// Read the directory at the specified path and return the names /// of its entries associated with their [`FileType`]. fn read_dir(&self, path: PathBuf) -> Result, ErrorKind>; + + /// Returns the root of the store directory, if such a thing + /// exists in the evaluation context. + fn store_dir(&self) -> Option { + None + } } /// Implementation of [`EvalIO`] that simply uses the equivalent -- cgit 1.4.1