difftreelog
refactor nix-eval is now fully sync, parallelism should be explicit at the callsite
in: trunk
6 files changed
Cargo.lockdiffbeforeafterboth2070 "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",cmds/fleet/src/cmds/build_systems.rsdiffbeforeafterboth8 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};131314#[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 .await39 .expect("system derivation build should not panic")?;384039 // We already have system profiles for backups.41 // We already have system profiles for backups.40 if !host.local {42 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.rsdiffbeforeafterboth10use 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;151638 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 .await45 .expect("tf.json derivation should not fail")?;42 let data = fs::read(&data).await?;46 let data = fs::read(&data).await?;434744 create_dir_all(&dir).await?;48 create_dir_all(&dir).await?;crates/nix-eval/Cargo.tomldiffbeforeafterboth11serde = { workspace = true, features = ["derive"] }11serde = { workspace = true, features = ["derive"] }12serde_json.workspace = true12serde_json.workspace = true13thiserror.workspace = true13thiserror.workspace = true14tokio = { workspace = true }15tokio-util.workspace = true16tracing.workspace = true14tracing.workspace = true171518cxx = "1.0.168"16cxx = "1.0.168"crates/nix-eval/src/lib.rsdiffbeforeafterboth750 })?;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 }