From 73950bd2a360e37d4f7d9c06a59ac674efacc848 Mon Sep 17 00:00:00 2001 From: cy Date: Tue, 1 Apr 2025 15:26:01 -0400 Subject: [PATCH] make recursive optional and tune down concurrency --- src/main.rs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index 32d246e..0050392 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,12 +30,13 @@ struct PathInfo { impl PathInfo { // find derivations related to package - async fn from_package(package: &str) -> Vec { + async fn from_package(package: &str, recursive: bool) -> Vec { + let mut args = vec!["path-info", "--derivation", "--json"]; + if recursive { + args.push("--recursive"); + } let path_infos = Command::new("nix") - .arg("path-info") - .arg("--derivation") - .arg("--recursive") - .arg("--json") + .args(args) .arg(package) .output() .await @@ -81,8 +82,12 @@ struct Cli { #[arg(long, short)] upstream_cache: Vec, + /// Whether to pass --recursive to nix path-info. Can queue a huge number of paths to upload + #[arg(long, short, default_value_t = false)] + recursive: bool, + /// Concurrent upstream cache checkers - #[arg(long, default_value_t = 64)] + #[arg(long, default_value_t = 32)] upstream_checker_concurrency: u8, /// Concurrent uploaders @@ -90,7 +95,7 @@ struct Cli { uploader_concurrency: u8, /// Concurrent nix-store commands to run - #[arg(long, default_value_t = 128)] + #[arg(long, default_value_t = 32)] nix_store_concurrency: u8, } @@ -109,7 +114,7 @@ async fn main() { debug!("upstream caches: {:#?}", upstream_caches); println!("querying nix path-info"); - let derivations = PathInfo::from_package(package).await; + let derivations = PathInfo::from_package(package, cli.recursive).await; println!("got {} derivations", derivations.len()); println!("querying nix-store");