snix_glue/
lib.rs

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