prefetch-npm-deps: support NIX_BUILD_CORES

This commit is contained in:
Lily Foster 2023-06-29 09:46:33 -04:00
parent 46e3229c8d
commit 9af0383296
No known key found for this signature in database
GPG Key ID: 49340081E484C893

View File

@ -182,6 +182,18 @@ fn main() -> anyhow::Result<()> {
process::exit(1);
}
if let Ok(jobs) = env::var("NIX_BUILD_CORES") {
if !jobs.is_empty() {
rayon::ThreadPoolBuilder::new()
.num_threads(
jobs.parse()
.expect("NIX_BUILD_CORES must be a whole number"),
)
.build_global()
.unwrap();
}
}
if args[1] == "--fixup-lockfile" {
let lock = serde_json::from_str(&fs::read_to_string(&args[2])?)?;