From 91dbf60e1ee45403faaa38aca48cd362a1889095 Mon Sep 17 00:00:00 2001 From: seth Date: Fri, 13 Sep 2024 19:31:06 -0400 Subject: fix: check all nixpkgs installables when none are given (#3) * fix: actually check all nixpkgs installables when none are given * build(nix): fix darwin --- src/cli.rs | 1 - src/command.rs | 21 +++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/cli.rs b/src/cli.rs index 073162c..41587c8 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -4,7 +4,6 @@ use clap::Parser; #[command(version, about, long_about = None)] pub struct Cli { /// A list of Nix installables to look for. If not given, all paths in nixpkgs are checked - #[arg(required_unless_present("configuration"))] pub installables: Option>, /// Flake reference pointing to a NixOS or nix-darwin configuration diff --git a/src/command.rs b/src/command.rs index ef3461e..8e8a312 100644 --- a/src/command.rs +++ b/src/command.rs @@ -16,11 +16,14 @@ impl Run for crate::Cli { #[instrument(skip(self))] async fn run(&self) -> Result<()> { let store_paths = if let Some(installables) = self.installables.clone() { - installables_paths(installables).await? + resolve_installables(installables).await? } else if let Some(configuration) = &self.configuration { - configuration_paths(configuration)? + println!("❓ Indexing requisites of configuration closure"); + nix::configuration_closure_paths(configuration)? } else { - nix::all_flake_installables(&self.flake)? + println!("❓ Indexing all installables of flake `{}`", self.flake); + let installables = nix::all_flake_installables(&self.flake)?; + resolve_installables(installables).await? }; check_store_paths(&self.binary_cache, &store_paths, self.show_missing).await?; @@ -30,9 +33,9 @@ impl Run for crate::Cli { } #[instrument(skip(installables))] -async fn installables_paths(installables: Vec) -> Result> { +async fn resolve_installables(installables: Vec) -> Result> { println!( - "🔃 Attempting to evaluating {} installable(s)", + "🔃 Attempting to evaluate {} installable(s)", installables.len() ); @@ -53,14 +56,8 @@ async fn installables_paths(installables: Vec) -> Result> { .await?; println!("✅ Evaluated {} installable(s)!", out_paths.len()); - Ok(out_paths) -} -#[instrument(skip(configuration_ref))] -fn configuration_paths(configuration_ref: &str) -> Result> { - println!("❓ Indexing requisites of configuration closure"); - let closure_paths = nix::configuration_closure_paths(configuration_ref)?; - Ok(closure_paths) + Ok(out_paths) } #[allow(clippy::cast_precision_loss)] -- cgit v1.2.3