summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseth <[email protected]>2024-09-13 19:31:06 -0400
committerGitHub <[email protected]>2024-09-13 23:31:06 +0000
commit91dbf60e1ee45403faaa38aca48cd362a1889095 (patch)
tree3eb410cc57b84d1c2e6d741a6551b815cc6bf86f
parentcc183fccca73df619c78dd0ca2567ac547c56ad2 (diff)
fix: check all nixpkgs installables when none are given (#3)
* fix: actually check all nixpkgs installables when none are given * build(nix): fix darwin
-rw-r--r--flake.nix7
-rw-r--r--src/cli.rs1
-rw-r--r--src/command.rs21
3 files changed, 16 insertions, 13 deletions
diff --git a/flake.nix b/flake.nix
index b8d9d24..429b61c 100644
--- a/flake.nix
+++ b/flake.nix
@@ -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 ]}"
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<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)]