pub struct Store { /* private fields */ }Implementations§
Source§impl Store
impl Store
Sourcepub fn open<'a, 'b>(
url: Option<&str>,
params: impl IntoIterator<Item = (&'a str, &'b str)>,
) -> Result<Self>
pub fn open<'a, 'b>( url: Option<&str>, params: impl IntoIterator<Item = (&'a str, &'b str)>, ) -> Result<Self>
Open a store.
See nix_bindings_store_sys::store_open for more information.
Sourcepub unsafe fn raw_ptr(&self) -> *mut Store
pub unsafe fn raw_ptr(&self) -> *mut Store
§Safety
The returned pointer is only valid as long as the Store is alive.
pub fn get_uri(&mut self) -> Result<String>
pub fn get_storedir(&mut self) -> Result<String>
pub fn parse_store_path(&mut self, path: &str) -> Result<StorePath>
pub fn real_path(&mut self, path: &StorePath) -> Result<String>
Sourcepub fn derivation_from_json(&mut self, json: &str) -> Result<Derivation>
pub fn derivation_from_json(&mut self, json: &str) -> Result<Derivation>
Parse a derivation from JSON.
Requires Nix 2.33 or later.
The JSON format follows the Nix derivation JSON schema.
Note that this format is experimental as of writing.
The derivation is not added to the store; use Store::add_derivation for that.
§Parameters
json: A JSON string representing the derivation
§Returns
A Derivation object if parsing succeeds, or an error if the JSON is invalid
or malformed.
Sourcepub fn add_derivation(&mut self, drv: &Derivation) -> Result<StorePath>
pub fn add_derivation(&mut self, drv: &Derivation) -> Result<StorePath>
Sourcepub fn realise(
&mut self,
path: &StorePath,
) -> Result<BTreeMap<String, StorePath>>
pub fn realise( &mut self, path: &StorePath, ) -> Result<BTreeMap<String, StorePath>>
Build a derivation and return its outputs.
Requires Nix 2.33 or later.
This builds the derivation at the given store path and returns a map of output
names to their realized store paths. The derivation must already exist in the store
(see Store::add_derivation).
§Parameters
path: The store path of the derivation to build (typically ending in.drv)
§Returns
A BTreeMap mapping output names (e.g., “out”, “dev”, “doc”) to their store paths.
The map is ordered alphabetically by output name for deterministic iteration.
Sourcepub fn get_fs_closure(
&mut self,
store_path: &StorePath,
flip_direction: bool,
include_outputs: bool,
include_derivers: bool,
) -> Result<Vec<StorePath>>
pub fn get_fs_closure( &mut self, store_path: &StorePath, flip_direction: bool, include_outputs: bool, include_derivers: bool, ) -> Result<Vec<StorePath>>
Get the closure of a specific store path.
Requires Nix 2.33 or later.
Computes the filesystem closure (dependency graph) of a store path, with options to control the direction and which related paths to include.
§Parameters
store_path: The path to compute the closure fromflip_direction: If false, compute the forward closure (paths referenced by this path). If true, compute the backward closure (paths that reference this path).include_outputs: Whenflip_directionis false: for any derivation in the closure, include its outputs. Whenflip_directionis true: for any output in the closure, include derivations that produce it.include_derivers: Whenflip_directionis false: for any output in the closure, include the derivation that produced it. Whenflip_directionis true: for any derivation in the closure, include its outputs.
§Returns
A vector of store paths in the closure, in no particular order.