mirror of
https://github.com/DeterminateSystems/flake-checker.git
synced 2024-08-17 01:50:23 +03:00
Combine into a single impl for FlakeLock
This commit is contained in:
parent
92c4775227
commit
4336c8d394
19
src/flake.rs
19
src/flake.rs
@ -114,6 +114,14 @@ impl FlakeLock {
|
||||
let flake_lock: FlakeLock = serde_json::from_str(&flake_lock_file)?;
|
||||
Ok(flake_lock)
|
||||
}
|
||||
|
||||
fn nixpkgs_deps(&self) -> HashMap<String, Node> {
|
||||
self.nodes
|
||||
.iter()
|
||||
.filter(|(k, v)| matches!(v, Node::Repo(_)) && k == &"nixpkgs")
|
||||
.map(|(k, v)| (k.clone(), v.clone()))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for FlakeLock {
|
||||
@ -195,17 +203,6 @@ impl<'de> Deserialize<'de> for FlakeLock {
|
||||
}
|
||||
}
|
||||
|
||||
impl FlakeLock {
|
||||
fn nixpkgs_deps(&self) -> HashMap<String, Node> {
|
||||
// TODO: make this more robust for real-world use cases
|
||||
self.nodes
|
||||
.iter()
|
||||
.filter(|(k, v)| matches!(v, Node::Repo(_)) && k == &"nixpkgs")
|
||||
.map(|(k, v)| (k.clone(), v.clone()))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
enum Node {
|
||||
|
Loading…
Reference in New Issue
Block a user