pub struct FlakeLock {
pub nodes: BTreeMap<String, FlakeNode>,
pub root: String,
pub version: u32,
}Expand description
A parsed and validated flake.lock file.
Fields§
§nodes: BTreeMap<String, FlakeNode>All nodes keyed by their name.
root: StringName of the root node (usually "root").
version: u32Lock file schema version (must be 7).
Implementations§
Source§impl FlakeLock
impl FlakeLock
Sourcepub fn parse(json: &str) -> Result<FlakeLock, FlakeLockError>
pub fn parse(json: &str) -> Result<FlakeLock, FlakeLockError>
Parse a flake.lock from its JSON text.
Sourcepub fn to_json(&self) -> Result<String, FlakeLockError>
pub fn to_json(&self) -> Result<String, FlakeLockError>
Serialize the lock back to pretty-printed JSON.
Sourcepub fn root_node(&self) -> Result<&FlakeNode, FlakeLockError>
pub fn root_node(&self) -> Result<&FlakeNode, FlakeLockError>
Get the root node.
Sourcepub fn root_inputs(&self) -> Result<Vec<(String, String)>, FlakeLockError>
pub fn root_inputs(&self) -> Result<Vec<(String, String)>, FlakeLockError>
Return the direct inputs of the root node as (input_name, node_name) pairs,
resolving follows along the way.
Sourcepub fn resolve_ref(
&self,
_parent: &str,
input_ref: &InputRef,
) -> Result<String, FlakeLockError>
pub fn resolve_ref( &self, _parent: &str, input_ref: &InputRef, ) -> Result<String, FlakeLockError>
Resolve an InputRef to a concrete node name.
Direct(name)simply returnsname.Follows(path)walks the path from the root node (Nix semantics:["nixpkgs"]means “follow root’s nixpkgs input”;["utils", "nixpkgs"]means “follow root -> utils -> nixpkgs”).
Sourcepub fn resolve_input(&self, path: &[&str]) -> Result<&FlakeNode, FlakeLockError>
pub fn resolve_input(&self, path: &[&str]) -> Result<&FlakeNode, FlakeLockError>
Walk the input graph from the root following a dotted-style path.
resolve_input(&["utils", "nixpkgs"]) starts at root, enters the
utils input, then enters that node’s nixpkgs input, resolving any
follows along the way.
Sourcepub fn resolve_node_input(
&self,
node_name: &str,
input_name: &str,
) -> Result<String, FlakeLockError>
pub fn resolve_node_input( &self, node_name: &str, input_name: &str, ) -> Result<String, FlakeLockError>
Resolve one edge of the input graph: given the node name of a flake
in the lock and the input name it declares, return the concrete node
name that input resolves to — walking any follows redirection.
This is the load-bearing primitive for transitive-input resolution.
CppNix pins a flake’s entire input closure in the ROOT lock’s node
graph: a sub-flake’s inputs.substrate edge is stored on nodes[node]
(as a direct node ref or a follows path rooted at the lock’s root),
so the sub-flake’s OWN flake.lock is irrelevant once the root lock
exists. A consumer that recurses into the sub-flake and re-reads its
own lock resolves a different revision than nix (the sub-flake’s
independent pin instead of the root’s follows target). Use this to
resolve every transitive input against the one authoritative graph.
Sourcepub fn node_input_edges(&self, node_name: &str) -> Vec<(String, String)>
pub fn node_input_edges(&self, node_name: &str) -> Vec<(String, String)>
Return the resolved (input_name, target_node_name) pairs for a node,
in the lock’s declaration order (BTreeMap ⇒ deterministic).
Unresolvable edges (a follows into a missing sibling) are skipped —
the caller falls back to a stub input, matching the pre-existing
resolve-what-you-can behavior of evaluate_flake.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FlakeLock
impl<'de> Deserialize<'de> for FlakeLock
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<FlakeLock, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<FlakeLock, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for FlakeLock
impl Serialize for FlakeLock
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for FlakeLock
impl RefUnwindSafe for FlakeLock
impl Send for FlakeLock
impl Sync for FlakeLock
impl Unpin for FlakeLock
impl UnsafeUnpin for FlakeLock
impl UnwindSafe for FlakeLock
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.