diff --git a/CHANGELOG.md b/CHANGELOG.md index fd35eea..ee36b57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,9 @@ for the up to date details! - Use `AssertPathExists` instead of conditional path existence checks for key services. - Built paths printed to stdout being clobbered with the status bar. - Not re-exporting `outputs.makeHive` under `outputs.lib.makeHive`. +- Evaluating a flake hive attribute will now correctly use the `/nix/store` path returned from + `nix flake prefetch`, instead of the `--path` URI. This has a small speed gain + of about `1.07 ± 0.03` times faster in testing. ## [v1.3.0] - 2026-05-02 diff --git a/crates/core/src/commands/common.rs b/crates/core/src/commands/common.rs index a6e50ec..d69abac 100644 --- a/crates/core/src/commands/common.rs +++ b/crates/core/src/commands/common.rs @@ -13,7 +13,7 @@ use crate::{ }, errors::{CommandError, HiveInitialisationError, HiveLibError, get_common_copy_path_help}, hive::{ - HiveLocation, + FlakePrefetch, HiveLocation, node::{Context, Push, SharedTarget}, }, }; @@ -110,9 +110,13 @@ pub async fn evaluate_hive_attribute( modifiers: SubCommandModifiers, ) -> Result { let attribute = match location { - HiveLocation::Flake { uri, .. } => { + HiveLocation::Flake { + prefetch: FlakePrefetch { store_path, .. }, + .. + } => { format!( - "{uri}#wire.{}", + "{}#wire.{}", + store_path.to_absolute_path(), match goal { EvalGoal::Inspect => "inspect".to_string(), EvalGoal::Names => "names".to_string(), diff --git a/crates/core/src/hive/steps/build.rs b/crates/core/src/hive/steps/build.rs index 0bc510a..7953a60 100644 --- a/crates/core/src/hive/steps/build.rs +++ b/crates/core/src/hive/steps/build.rs @@ -13,7 +13,7 @@ use crate::{ run_command_with_env, trace_nix_log_message, }, hive::{ - HiveLocation, + FlakePrefetch, HiveLocation, executor::{BuildOutputHandle, EvaluationOutputHandle}, node::{Context, ExecuteStep, SharedTarget}, }, @@ -153,8 +153,15 @@ impl ExecuteStep for Build { NixCommandBuildMetadata::Locally { cached_derivation: None, } => match &*ctx.hive_location { - HiveLocation::Flake { uri, .. } => { - format!("{uri}#wire.nodes.{}.config.system.build.toplevel", ctx.name) + HiveLocation::Flake { + prefetch: FlakePrefetch { store_path, .. }, + .. + } => { + format!( + "{}#wire.nodes.{}.config.system.build.toplevel", + store_path.to_absolute_path(), + ctx.name + ) } HiveLocation::HiveNix(path) => { format!(