Skip to content

Commit

Permalink
Ignore root node itself as flake inputs
Browse files Browse the repository at this point in the history
This is not perfect but we don't support out-of-store flake inputs yet.

Fixes #71
  • Loading branch information
oxalica committed Mar 11, 2023
1 parent bbca41c commit 09bcbd1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/nix-interop/src/flake_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@ pub fn resolve_flake_locked_inputs(
serde_json::from_slice::<FlakeLock>(lock_src).context("Failed to parse flake lock")?;

let mut resolver = Resolver::new(&lock);
let inputs = resolver
let root_node = resolver.get_node(&lock.root).context("Missing root node")?;
let mut inputs = resolver
.resolve_node_inputs(&lock.root)
.context("Failed to resolve inputs from flake lock")?;

// Ignore the root node which is unlocked. This happens in cycle flake inputs.
// TODO: Should come up a way to correctly handle it in database.
inputs.retain(|&(_, node)| !std::ptr::eq(node, root_node));

let hashes = inputs
.iter()
.map(|(input_name, node)| {
Expand Down

0 comments on commit 09bcbd1

Please sign in to comment.