about summary refs log blame commit diff
path: root/tvix/glue/src/lib.rs
blob: f6f99f3c32a370e1a1aa60155f05fda2fed50a8f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                 
                 

                    
                   


                      

             


            
                                                                      

                                                                  

                                                                   
                                     






                                                               
 
pub mod builtins;
pub mod fetchers;
pub mod known_paths;
pub mod refscan;
pub mod tvix_build;
pub mod tvix_io;
pub mod tvix_store_io;

mod fetchurl;

#[cfg(test)]
mod tests;

/// Tell the Evaluator to resolve `<nix>` to the path `/__corepkgs__`,
/// which has special handling in [tvix_io::TvixIO].
/// This is used in nixpkgs to import `fetchurl.nix` from `<nix>`.
pub fn configure_nix_path<'co, 'ro, 'env, IO>(
    eval_builder: tvix_eval::EvaluationBuilder<'co, 'ro, 'env, IO>,
    nix_search_path: &Option<String>,
) -> tvix_eval::EvaluationBuilder<'co, 'ro, 'env, IO> {
    eval_builder.nix_path(
        nix_search_path
            .as_ref()
            .map(|p| format!("nix=/__corepkgs__:{}", p))
            .or_else(|| Some("nix=/__corepkgs__".to_string())),
    )
}