Use the crate name in the user-agent, similar to tvix-[ca]store. Change-Id: I10527fb1f29006dbfd8630d8bb1f00d7905efdd3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12851 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: Vladimir Kryachko <v.kryachko@gmail.com> Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
29 lines
897 B
Rust
29 lines
897 B
Rust
pub mod builtins;
|
|
pub mod fetchers;
|
|
pub mod known_paths;
|
|
pub mod tvix_build;
|
|
pub mod tvix_io;
|
|
pub mod tvix_store_io;
|
|
|
|
mod fetchurl;
|
|
|
|
// Used as user agent in various HTTP Clients
|
|
const USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));
|
|
|
|
#[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())),
|
|
)
|
|
}
|