prefetch-npm-deps: support NIX_BUILD_CORES

(cherry picked from commit 9af0383296)
This commit is contained in:
Lily Foster
2023-06-29 09:46:33 -04:00
parent d8bb6c681c
commit 25ccf40150

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])?)?;