git.delta.rocks / jrsonnet / refs/commits / cc4299b11a7b

difftreelog

refactor nix-eval is now fully sync, parallelism should be explicit at the callsite

zorryxklYaroslav Bolyukin2025-09-18parent: #cf89cc0.patch.diff
in: trunk

6 files changed

modifiedCargo.lockdiffbeforeafterboth
2070 "serde_json",2070 "serde_json",
2071 "test-log",2071 "test-log",
2072 "thiserror 2.0.16",2072 "thiserror 2.0.16",
2073 "tokio",
2074 "tokio-util",
2075 "tracing",2073 "tracing",
2076 "tracing-indicatif",2074 "tracing-indicatif",
2077 "vte 0.15.0",2075 "vte 0.15.0",
modifiedcmds/fleet/src/cmds/build_systems.rsdiffbeforeafterboth
8 opts::FleetOpts,8 opts::FleetOpts,
9};9};
10use nix_eval::nix_go;10use nix_eval::nix_go;
11use tokio::task::LocalSet;11use tokio::task::{LocalSet, spawn_blocking};
12use tracing::{Instrument, error, field, info, info_span, warn};12use tracing::{Instrument, error, field, info, info_span, warn};
1313
14#[derive(Parser)]14#[derive(Parser)]
34 // let action = Action::from(self.subcommand.clone());34 // let action = Action::from(self.subcommand.clone());
35 let nixos = host.nixos_config().await?;35 let nixos = host.nixos_config().await?;
36 let drv = nix_go!(nixos.system.build[{ build_attr }]);36 let drv = nix_go!(nixos.system.build[{ build_attr }]);
37 let out_output = drv.build("out").await?;37 let out_output = spawn_blocking(move || drv.build("out"))
38 .await
39 .expect("system derivation build should not panic")?;
3840
39 // We already have system profiles for backups.41 // We already have system profiles for backups.
40 if !host.local {42 if !host.local {
modifiedcmds/fleet/src/cmds/secrets/mod.rsdiffbeforeafterboth
19use 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};
2424
25#[derive(Parser)]25#[derive(Parser)]
288288
289 let generator = nix_go!(call_package(generator)(Obj {}));289 let generator = nix_go!(call_package(generator)(Obj {}));
290290
291 let generator = generator.build("out").await?;291 let generator = spawn_blocking(move || generator.build("out"))
292 .await
293 .expect("nix build shouldn't fail")?;
292 let generator = host.remote_derivation(&generator).await?;294 let generator = host.remote_derivation(&generator).await?;
293295
294 let out_parent = host.mktemp_dir().await?;296 let out_parent = host.mktemp_dir().await?;
modifiedcmds/fleet/src/cmds/tf.rsdiffbeforeafterboth
10use tokio::{10use tokio::{
11 fs::{self, create_dir_all},11 fs::{self, create_dir_all},
12 process::Command,12 process::Command,
13 task::spawn_blocking,
13};14};
14use tracing::debug;15use tracing::debug;
1516
38 debug!("generating terraform configs");39 debug!("generating terraform configs");
39 let system = &config.local_system;40 let system = &config.local_system;
40 let config = &config.config_field;41 let config = &config.config_field;
41 let data: PathBuf = nix_go!(config.tf({ system })).build("out").await?;42 let data = nix_go!(config.tf({ system }));
43 let data: PathBuf = spawn_blocking(move || data.build("out"))
44 .await
45 .expect("tf.json derivation should not fail")?;
42 let data = fs::read(&data).await?;46 let data = fs::read(&data).await?;
4347
44 create_dir_all(&dir).await?;48 create_dir_all(&dir).await?;
modifiedcrates/nix-eval/Cargo.tomldiffbeforeafterboth
11serde = { workspace = true, features = ["derive"] }11serde = { workspace = true, features = ["derive"] }
12serde_json.workspace = true12serde_json.workspace = true
13thiserror.workspace = true13thiserror.workspace = true
14tokio = { workspace = true }
15tokio-util.workspace = true
16tracing.workspace = true14tracing.workspace = true
1715
18cxx = "1.0.168"16cxx = "1.0.168"
modifiedcrates/nix-eval/src/lib.rsdiffbeforeafterboth
750 })?;750 })?;
751 Ok(out)751 Ok(out)
752 }752 }
753 pub async fn build(&self, output: &str) -> Result<PathBuf> {753 pub fn build(&self, output: &str) -> Result<PathBuf> {
754 if !self.is_derivation() {754 if !self.is_derivation() {
755 bail!("expected derivation to build")755 bail!("expected derivation to build")
756 }756 }