diff options
| -rw-r--r-- | flake.nix | 7 | ||||
| -rw-r--r-- | src/cli.rs | 1 | ||||
| -rw-r--r-- | src/command.rs | 21 |
3 files changed, 16 insertions, 13 deletions
@@ -151,6 +151,7 @@ lib, stdenv, rustPlatform, + darwin, installShellFiles, makeBinaryWrapper, nix, @@ -179,6 +180,12 @@ makeBinaryWrapper ]; + buildInputs = lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.CoreFoundation + darwin.apple_sdk.frameworks.SystemConfiguration + darwin.libiconv + ]; + postInstall = '' wrapProgram $out/bin/nix-forecast --suffix PATH : "${lib.makeBinPath [ nix ]}" @@ -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<Vec<String>>, /// 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<String>) -> Result<Vec<String>> { +async fn resolve_installables(installables: Vec<String>) -> Result<Vec<String>> { println!( - "🔃 Attempting to evaluating {} installable(s)", + "🔃 Attempting to evaluate {} installable(s)", installables.len() ); @@ -53,14 +56,8 @@ async fn installables_paths(installables: Vec<String>) -> Result<Vec<String>> { .await?; println!("✅ Evaluated {} installable(s)!", out_paths.len()); - Ok(out_paths) -} -#[instrument(skip(configuration_ref))] -fn configuration_paths(configuration_ref: &str) -> Result<Vec<String>> { - 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)] |
