pub struct EvalStateBuilder { /* private fields */ }Expand description
Builder for configuring and creating an EvalState.
Provides advanced configuration options for evaluation context setup.
Use EvalState::new for simple cases or this builder for custom configuration.
Requires Nix 2.26.0 or later.
§Examples
let store = Store::open(None, HashMap::new())?;
let mut es: EvalState = EvalStateBuilder::new(store)?
.lookup_path(["nixpkgs=/path/to/nixpkgs", "home-manager=/path/to/hm"])?
.build()?;
let value = es.eval_from_string("<nixpkgs>", /* path display: */ "in-memory")?;Implementations§
Source§impl EvalStateBuilder
impl EvalStateBuilder
Sourcepub fn new(store: Store) -> Result<EvalStateBuilder>
pub fn new(store: Store) -> Result<EvalStateBuilder>
Creates a new EvalStateBuilder.
Sourcepub fn lookup_path<'a>(
self,
path: impl IntoIterator<Item = &'a str>,
) -> Result<Self>
pub fn lookup_path<'a>( self, path: impl IntoIterator<Item = &'a str>, ) -> Result<Self>
Sets the lookup path for Nix expression evaluation.
Sourcepub fn load_ambient_settings(self, load: bool) -> Self
pub fn load_ambient_settings(self, load: bool) -> Self
Sets whether to load settings from the ambient environment.
When enabled (default), calls nix_eval_state_builder_load to load settings
from NIX_CONFIG and other environment variables. When disabled, only the
explicitly configured settings are used.
Sourcepub fn raw_ptr(&self) -> *mut eval_state_builder
pub fn raw_ptr(&self) -> *mut eval_state_builder
Returns a raw pointer to the underlying eval state builder.
§Safety
The caller must ensure that the pointer is not used beyond the lifetime of this builder.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EvalStateBuilder
impl RefUnwindSafe for EvalStateBuilder
impl !Send for EvalStateBuilder
impl !Sync for EvalStateBuilder
impl Unpin for EvalStateBuilder
impl UnwindSafe for EvalStateBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more