feat(tvix/cli): use TvixStoreIO instead of NixCompatIO
This switches tvix-cli over from using `NixCompatIO` to `TvixStoreIO`. For now, we simply instantiate in-memory services instead of getting fancy with constructors inside tvix-store, but long-term, we might want to support some URI syntax, to make this configurable at runtime. nixpkgs eval tests might be fine (and fast!) with a purely in-memory backend, but other usages might involve talking to a local tvix-store over gRPC (using the gRPC client, either unix domain socket or even further away remote), or running tvix-store in "embedded" mode (using another client than the gRPC client). Change-Id: I509afd3dc5ce3f2d52b0fb7067748fab820e26ab Reviewed-on: https://cl.tvl.fyi/c/depot/+/8572 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
This commit is contained in:
		
							parent
							
								
									ad6b6b14db
								
							
						
					
					
						commit
						63047449d7
					
				
					 4 changed files with 24 additions and 1 deletions
				
			
		
							
								
								
									
										1
									
								
								tvix/Cargo.lock
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								tvix/Cargo.lock
									
										
									
										generated
									
									
									
								
							| 
						 | 
				
			
			@ -2640,6 +2640,7 @@ dependencies = [
 | 
			
		|||
 "ssri",
 | 
			
		||||
 "thiserror",
 | 
			
		||||
 "tvix-eval",
 | 
			
		||||
 "tvix-store",
 | 
			
		||||
 "wu-manber",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7769,6 +7769,10 @@ rec {
 | 
			
		|||
            name = "tvix-eval";
 | 
			
		||||
            packageId = "tvix-eval";
 | 
			
		||||
          }
 | 
			
		||||
          {
 | 
			
		||||
            name = "tvix-store";
 | 
			
		||||
            packageId = "tvix-store";
 | 
			
		||||
          }
 | 
			
		||||
          {
 | 
			
		||||
            name = "wu-manber";
 | 
			
		||||
            packageId = "wu-manber";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,6 +9,7 @@ path = "src/main.rs"
 | 
			
		|||
 | 
			
		||||
[dependencies]
 | 
			
		||||
nix-compat = { path = "../nix-compat" }
 | 
			
		||||
tvix-store = { path = "../store" }
 | 
			
		||||
tvix-eval = { path = "../eval" }
 | 
			
		||||
rustyline = "10.0.0"
 | 
			
		||||
clap = { version = "4.0", features = ["derive", "env"] }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,6 +14,9 @@ use known_paths::KnownPaths;
 | 
			
		|||
use rustyline::{error::ReadlineError, Editor};
 | 
			
		||||
use tvix_eval::observer::{DisassemblingObserver, TracingObserver};
 | 
			
		||||
use tvix_eval::{Builtin, Value};
 | 
			
		||||
use tvix_store::blobservice::MemoryBlobService;
 | 
			
		||||
use tvix_store::directoryservice::MemoryDirectoryService;
 | 
			
		||||
use tvix_store::pathinfoservice::MemoryPathInfoService;
 | 
			
		||||
 | 
			
		||||
#[derive(Parser)]
 | 
			
		||||
struct Args {
 | 
			
		||||
| 
						 | 
				
			
			@ -63,9 +66,23 @@ fn interpret(code: &str, path: Option<PathBuf>, args: &Args, explain: bool) -> b
 | 
			
		|||
    let known_paths: Rc<RefCell<KnownPaths>> = Default::default();
 | 
			
		||||
 | 
			
		||||
    eval.strict = args.strict;
 | 
			
		||||
 | 
			
		||||
    let blob_service = MemoryBlobService::default();
 | 
			
		||||
    let directory_service = MemoryDirectoryService::default();
 | 
			
		||||
    let path_info_service = MemoryPathInfoService::default();
 | 
			
		||||
    let nar_calculation_service = tvix_store::nar::NonCachingNARCalculationService::new(
 | 
			
		||||
        blob_service.clone(),
 | 
			
		||||
        directory_service.clone(),
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    eval.io_handle = Box::new(tvix_io::TvixIO::new(
 | 
			
		||||
        known_paths.clone(),
 | 
			
		||||
        nix_compat::NixCompatIO::new(),
 | 
			
		||||
        tvix_store::TvixStoreIO::new(
 | 
			
		||||
            blob_service,
 | 
			
		||||
            directory_service,
 | 
			
		||||
            path_info_service,
 | 
			
		||||
            nar_calculation_service,
 | 
			
		||||
        ),
 | 
			
		||||
    ));
 | 
			
		||||
 | 
			
		||||
    // bundle fetchurl.nix (used in nixpkgs) by resolving <nix> to
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue