feat(tvix/eval): implement builtins.path

Now, it supports almost everything except `recursive = false;`, i.e. `flat`-ingestion
because we have no knob exposed in the tvix store import side to do it.

This has been tested to work.

Change-Id: I2e9da10ceccdfbf45b43c532077ed45d6306aa98
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10597
Tested-by: BuildkiteCI
Autosubmit: raitobezarius <tvl@lahfa.xyz>
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Ryan Lahfa 2024-01-09 00:16:52 +01:00 committed by raitobezarius
parent 14fe65a50b
commit cecb5e295a
6 changed files with 367 additions and 31 deletions

View file

@ -53,3 +53,19 @@ impl From<FetcherError> for tvix_eval::ErrorKind {
tvix_eval::ErrorKind::TvixError(Rc::new(err))
}
}
/// Errors related to `builtins.path` and `builtins.filterSource`,
/// a.k.a. "importing" builtins.
#[derive(Debug, Error)]
pub enum ImportError {
#[error("non-file '{0}' cannot be imported in 'flat' mode")]
FlatImportOfNonFile(String),
#[error("hash mismatch at ingestion of '{0}', expected: '{1}', got: '{2}'")]
HashMismatch(String, NixHash, NixHash),
}
impl From<ImportError> for tvix_eval::ErrorKind {
fn from(err: ImportError) -> Self {
tvix_eval::ErrorKind::TvixError(Rc::new(err))
}
}