tvix_glue/
lib.rs

1pub mod builtins;
2// pub mod fetchers;
3pub mod known_paths;
4// pub mod tvix_build;
5pub mod tvix_io;
6pub mod tvix_store_io;
7
8// mod fetchurl;
9
10// Used as user agent in various HTTP Clients
11#[allow(dead_code)]
12const USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));
13
14#[cfg(test)]
15mod tests;
16
17/// Tell the Evaluator to resolve `<nix>` to the path `/__corepkgs__`,
18/// which has special handling in [tvix_io::TvixIO].
19/// This is used in nixpkgs to import `fetchurl.nix` from `<nix>`.
20pub fn configure_nix_path<'co, 'ro, 'env>(
21    eval_builder: tvix_eval::EvaluationBuilder<'co, 'ro, 'env>,
22    nix_search_path: &Option<String>,
23) -> tvix_eval::EvaluationBuilder<'co, 'ro, 'env> {
24    eval_builder.nix_path(
25        nix_search_path
26            .as_ref()
27            .map(|p| format!("nix=/__corepkgs__:{p}"))
28            .or_else(|| Some("nix=/__corepkgs__".to_string())),
29    )
30}