Skip to main content

nix_eval_state_allow_path

Function nix_eval_state_allow_path 

Source
pub unsafe extern "C" fn nix_eval_state_allow_path(
    context: *mut nix_c_context,
    state: *mut EvalState,
    str_: *const c_char,
) -> nix_err
Expand description

Register a store path in the evaluator’s access allowlist. In pure evaluation mode (–pure-eval) the Nix evaluator wraps the filesystem in an AllowListSourceAccessor that rejects any path not explicitly permitted. Nix’s own fetch builtins call allowPath after adding a path to the store so that the resulting path value can be used without triggering the access restriction. Call this before nix_init_path_string (or PrimOpRet::set_path) when your primop has added a path to the store and needs to return it as a Nix path value that is usable in pure evaluation mode.

§Arguments

  • context [out] - Optional. Stores error information.
  • state [in] - Eval state whose allowlist to update.
  • str [in] - Canonical store path string (e.g. /nix/store/…).

§Returns

NIX_OK on success, otherwise a nix_err describing the failure.