From 8f6ec2ec5c3ba8ab33126ec79de7702835592902 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Mon, 5 Jan 2026 20:57:51 -0500 Subject: [PATCH] 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. --- nix-bindings-expr/src/eval_state.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nix-bindings-expr/src/eval_state.rs b/nix-bindings-expr/src/eval_state.rs index 7d0808c..6fdedab 100644 --- a/nix-bindings-expr/src/eval_state.rs +++ b/nix-bindings-expr/src/eval_state.rs @@ -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