summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--src/cli.rs11
-rw-r--r--src/command.rs13
3 files changed, 18 insertions, 8 deletions
diff --git a/README.md b/README.md
index 0235703..139f5a4 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ Arguments:
Options:
-c, --configuration <CONFIGURATION> Flake reference pointing to a NixOS or nix-darwin configuration
- -b, --binary-cache <BINARY_CACHE> URL of the substituter to check [default: https://cache.nixos.org]
+ -b, --binary-caches <BINARY_CACHES> URLs of the substituters to check (can be passed more than once) [default: https://cache.nixos.org]
-f, --flake <FLAKE> Flake reference of nixpkgs (or other package repository) [default: nixpkgs]
-s, --show-missing Show a list of store paths not found in the substituter
-h, --help Print help
diff --git a/src/cli.rs b/src/cli.rs
index 41587c8..edfba5d 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -11,9 +11,14 @@ pub struct Cli {
#[arg(short, long, conflicts_with("installables"))]
pub configuration: Option<String>,
- /// URL of the substituter to check
- #[arg(short, long, default_value = "https://cache.nixos.org")]
- pub binary_cache: String,
+ /// URLs of the substituters to check (can be passed more than once)
+ #[arg(
+ alias = "binary-cache",
+ short,
+ long,
+ default_value = "https://cache.nixos.org"
+ )]
+ pub binary_caches: Vec<String>,
/// Flake reference of nixpkgs (or other package repository)
#[arg(short, long, default_value = "nixpkgs")]
diff --git a/src/command.rs b/src/command.rs
index 8e8a312..be1dd4c 100644
--- a/src/command.rs
+++ b/src/command.rs
@@ -26,7 +26,7 @@ impl Run for crate::Cli {
resolve_installables(installables).await?
};
- check_store_paths(&self.binary_cache, &store_paths, self.show_missing).await?;
+ check_store_paths(&self.binary_caches, &store_paths, self.show_missing).await?;
Ok(())
}
@@ -63,12 +63,12 @@ async fn resolve_installables(installables: Vec<String>) -> Result<Vec<String>>
#[allow(clippy::cast_precision_loss)]
#[instrument(skip(store_paths))]
async fn check_store_paths(
- binary_cache: &str,
+ binary_caches: &Vec<String>,
store_paths: &Vec<String>,
show_missing: bool,
) -> Result<()> {
let num_store_paths = store_paths.len();
- println!("🌡️ Checking for {num_store_paths} store path(s) in {binary_cache}",);
+ println!("🌡️ Checking for {num_store_paths} store path(s) in: {binary_caches:?}");
let http = <http::Client as http::Ext>::default();
let progress_bar = ProgressBar::new(num_store_paths as u64).with_style(progress_style()?);
@@ -78,7 +78,12 @@ async fn check_store_paths(
let http = &http;
let progress_bar = &progress_bar;
async move {
- let has_store_path = http.has_store_path(binary_cache, store_path).await?;
+ let mut has_store_path = false;
+ for binary_cache in binary_caches {
+ if http.has_store_path(binary_cache, store_path).await? {
+ has_store_path = true;
+ }
+ }
progress_bar.inc(1);
anyhow::Ok((has_store_path, store_path.as_str()))