diff options
author | Ryan Lahfa <tvl@lahfa.xyz> | 2024-01-17T06·45+0100 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-02-20T14·16+0000 |
commit | 73880786308d956061951114271f12a395f884b5 (patch) | |
tree | aa2fac4fd5caca348c66d5c3adde873de5091af1 /tvix/glue/src/tests | |
parent | 20833656aee4aaefdd83e7beb141a5e03f8c956d (diff) |
feat(tvix/eval): implement `builtins.filterSource` r/7578
We add a new set of builtins called `import_builtins`, which will contain import-related builtins, such as `builtins.path` and `builtins.filterSource`. Both can import paths into the store, with various knobs to alter the result, e.g. filtering, renaming, expected hashes. We introduce `filtered_ingest` which will drive the filtered ingestion via the Nix function via the generator machinery, and then we register the root node to the path info service inside the store. `builtins.filterSource` is very simple, `builtins.path` is a more complicated model requiring the same logic albeit more sophisticated with name customization, file ingestion method and expected SHA-256. Change-Id: I1083f37808b35f7b37818c8ffb9543d9682b2de2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10654 Autosubmit: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/glue/src/tests')
-rw-r--r-- | tvix/glue/src/tests/mod.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tvix/glue/src/tests/mod.rs b/tvix/glue/src/tests/mod.rs index ad6571e4d212..469ed17a5135 100644 --- a/tvix/glue/src/tests/mod.rs +++ b/tvix/glue/src/tests/mod.rs @@ -13,7 +13,7 @@ use tvix_store::pathinfoservice::{MemoryPathInfoService, PathInfoService}; use rstest::rstest; use crate::{ - builtins::{add_derivation_builtins, add_fetcher_builtins}, + builtins::{add_derivation_builtins, add_fetcher_builtins, add_import_builtins}, tvix_store_io::TvixStoreIO, }; @@ -54,7 +54,8 @@ fn eval_test(code_path: PathBuf, expect_success: bool) { eval.strict = true; add_derivation_builtins(&mut eval, tvix_store_io.clone()); - add_fetcher_builtins(&mut eval, tvix_store_io); + add_fetcher_builtins(&mut eval, tvix_store_io.clone()); + add_import_builtins(&mut eval, tvix_store_io.clone()); let result = eval.evaluate(code, Some(code_path.clone())); let failed = match result.value { |