difftreelog
refactor nix-eval is now fully sync, parallelism should be explicit at the callsite
in: trunk
6 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2070,8 +2070,6 @@
"serde_json",
"test-log",
"thiserror 2.0.16",
- "tokio",
- "tokio-util",
"tracing",
"tracing-indicatif",
"vte 0.15.0",
cmds/fleet/src/cmds/build_systems.rsdiffbeforeafterboth--- a/cmds/fleet/src/cmds/build_systems.rs
+++ b/cmds/fleet/src/cmds/build_systems.rs
@@ -8,7 +8,7 @@
opts::FleetOpts,
};
use nix_eval::nix_go;
-use tokio::task::LocalSet;
+use tokio::task::{LocalSet, spawn_blocking};
use tracing::{Instrument, error, field, info, info_span, warn};
#[derive(Parser)]
@@ -34,7 +34,9 @@
// let action = Action::from(self.subcommand.clone());
let nixos = host.nixos_config().await?;
let drv = nix_go!(nixos.system.build[{ build_attr }]);
- let out_output = drv.build("out").await?;
+ let out_output = spawn_blocking(move || drv.build("out"))
+ .await
+ .expect("system derivation build should not panic")?;
// We already have system profiles for backups.
if !host.local {
cmds/fleet/src/cmds/secrets/mod.rsdiffbeforeafterboth19use owo_colors::OwoColorize;19use owo_colors::OwoColorize;20use serde::Deserialize;20use serde::Deserialize;21use tabled::{Table, Tabled};21use tabled::{Table, Tabled};22use tokio::fs::read;22use tokio::{fs::read, task::spawn_blocking};23use tracing::{Instrument, error, info, info_span, warn};23use tracing::{Instrument, error, info, info_span, warn};242425#[derive(Parser)]25#[derive(Parser)]288288289 let generator = nix_go!(call_package(generator)(Obj {}));289 let generator = nix_go!(call_package(generator)(Obj {}));290290291 let generator = generator.build("out").await?;291 let generator = spawn_blocking(move || generator.build("out"))292 .await293 .expect("nix build shouldn't fail")?;292 let generator = host.remote_derivation(&generator).await?;294 let generator = host.remote_derivation(&generator).await?;293295294 let out_parent = host.mktemp_dir().await?;296 let out_parent = host.mktemp_dir().await?;cmds/fleet/src/cmds/tf.rsdiffbeforeafterboth--- a/cmds/fleet/src/cmds/tf.rs
+++ b/cmds/fleet/src/cmds/tf.rs
@@ -10,6 +10,7 @@
use tokio::{
fs::{self, create_dir_all},
process::Command,
+ task::spawn_blocking,
};
use tracing::debug;
@@ -38,7 +39,10 @@
debug!("generating terraform configs");
let system = &config.local_system;
let config = &config.config_field;
- let data: PathBuf = nix_go!(config.tf({ system })).build("out").await?;
+ let data = nix_go!(config.tf({ system }));
+ let data: PathBuf = spawn_blocking(move || data.build("out"))
+ .await
+ .expect("tf.json derivation should not fail")?;
let data = fs::read(&data).await?;
create_dir_all(&dir).await?;
crates/nix-eval/Cargo.tomldiffbeforeafterboth--- a/crates/nix-eval/Cargo.toml
+++ b/crates/nix-eval/Cargo.toml
@@ -11,8 +11,6 @@
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
thiserror.workspace = true
-tokio = { workspace = true }
-tokio-util.workspace = true
tracing.workspace = true
cxx = "1.0.168"
crates/nix-eval/src/lib.rsdiffbeforeafterboth--- a/crates/nix-eval/src/lib.rs
+++ b/crates/nix-eval/src/lib.rs
@@ -750,7 +750,7 @@
})?;
Ok(out)
}
- pub async fn build(&self, output: &str) -> Result<PathBuf> {
+ pub fn build(&self, output: &str) -> Result<PathBuf> {
if !self.is_derivation() {
bail!("expected derivation to build")
}