feat(tvix/derivation): implement Derivation::validate()

Change-Id: I87dfadda872439e108e5f678a5da63dd5b1915d1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7732
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2023-01-04 13:38:28 +01:00 committed by flokli
parent 407a9cd90f
commit cc626d686c
7 changed files with 207 additions and 2 deletions

View file

@ -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(())
}
}