Fix path coercion by calling eval_state_builder_load()

Without this call, settings from the global Nix configuration are never
loaded, leaving readOnlyMode = true (the default). This prevents Nix
from adding paths to the store during evaluation, causing errors like:

  error: path '/some/local/path' does not exist

This fix loads global settings before creating the EvalState, enabling
path coercion for local file references.
This commit is contained in:
Aaron Andersen 2026-01-05 20:57:51 -05:00
parent 800418e64b
commit 8f6ec2ec5c

View file

@ -288,6 +288,15 @@ impl EvalStateBuilder {
let mut context = Context::new();
// Load settings from global configuration (including readOnlyMode = false).
// This is necessary for path coercion to work (adding files to the store).
unsafe {
check_call!(raw::eval_state_builder_load(
&mut context,
self.eval_state_builder
))?;
}
// Note: these raw C string pointers borrow from self.lookup_path
let mut lookup_path: Vec<*const c_char> = self
.lookup_path