about summary refs log tree commit diff
path: root/tvix/derivation/src/output.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-01-04T12·38+0100
committerflokli <flokli@flokli.de>2023-01-04T21·58+0000
commitcc626d686cceed84e45d21bf32514a3a3f8e2b11 (patch)
tree8a211983e216149207a240713ff95ab0a662d173 /tvix/derivation/src/output.rs
parent407a9cd90f3a1ea3bb0cf4ced85cfacb29881b0c (diff)
feat(tvix/derivation): implement Derivation::validate() r/5591
Change-Id: I87dfadda872439e108e5f678a5da63dd5b1915d1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7732
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/derivation/src/output.rs')
-rw-r--r--tvix/derivation/src/output.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/tvix/derivation/src/output.rs b/tvix/derivation/src/output.rs
index 0d668c3e9952..2839110971d2 100644
--- a/tvix/derivation/src/output.rs
+++ b/tvix/derivation/src/output.rs
@@ -1,4 +1,5 @@
 use serde::{Deserialize, Serialize};
+use tvix_store::nixpath::NixPath;
 
 #[derive(Serialize, Deserialize)]
 pub struct Output {
@@ -20,4 +21,9 @@ impl Output {
     pub fn is_fixed(&self) -> bool {
         self.hash.is_some()
     }
+
+    pub fn validate(&self) -> anyhow::Result<()> {
+        NixPath::from_absolute_path(&self.path)?;
+        Ok(())
+    }
 }