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

difftreelog

feat adopt keep-going-by-default behavior

Lach2025-05-12parent: #03574ae.patch.diff
in: trunk

4 files changed

modifiedcrates/fleet-base/src/opts.rsdiffbeforeafterboth
--- a/crates/fleet-base/src/opts.rs
+++ b/crates/fleet-base/src/opts.rs
@@ -87,6 +87,13 @@
 	/// binfmt-declared qemu instead of trying to crosscompile
 	#[clap(long, default_value = env!("NIX_SYSTEM"))]
 	pub local_system: String,
+
+	/// By default fleet continues on single derivation build failure
+	/// this flag makes command fail immediately
+	///
+	/// Opposite of Nix's --keep-going
+	#[clap(long)]
+	pub fail_fast: bool,
 }
 
 impl FleetOpts {
@@ -204,6 +211,7 @@
 			directory.as_os_str().to_owned(),
 			nix_args.clone(),
 			self.local_system.clone(),
+			self.fail_fast,
 		)
 		.await?;
 		let nix_session = pool.get().await?;
modifiedcrates/nix-eval/src/pool.rsdiffbeforeafterboth
--- a/crates/nix-eval/src/pool.rs
+++ b/crates/nix-eval/src/pool.rs
@@ -9,7 +9,12 @@
 
 pub struct NixSessionPool(Pool<NixSessionPoolInner>);
 impl NixSessionPool {
-	pub async fn new(flake: OsString, nix_args: Vec<OsString>, nix_system: String) -> Result<Self> {
+	pub async fn new(
+		flake: OsString,
+		nix_args: Vec<OsString>,
+		nix_system: String,
+		fail_fast: bool,
+	) -> Result<Self> {
 		let inner = tokio::task::block_in_place(|| {
 			r2d2::Builder::<NixSessionPoolInner>::new()
 				.min_idle(Some(0))
@@ -17,6 +22,7 @@
 					flake,
 					nix_args,
 					nix_system,
+					fail_fast,
 				})
 		})?;
 		Ok(Self(inner))
@@ -30,6 +36,7 @@
 pub(crate) struct NixSessionPoolInner {
 	flake: OsString,
 	nix_args: Vec<OsString>,
+	fail_fast: bool,
 	pub(crate) nix_system: String,
 }
 
@@ -41,11 +48,12 @@
 			.get()
 			.expect("missed tokio runtime init!")
 			.enter();
-		Ok(futures::executor::block_on(NixSessionInner::new(
+		futures::executor::block_on(NixSessionInner::new(
 			self.flake.as_os_str(),
 			self.nix_args.iter().map(OsString::as_os_str),
 			self.nix_system.clone(),
-		))?)
+			self.fail_fast,
+		))
 	}
 
 	fn is_valid(&self, conn: &mut Self::Connection) -> std::result::Result<(), Self::Error> {
modifiedcrates/nix-eval/src/session.rsdiffbeforeafterboth
--- a/crates/nix-eval/src/session.rs
+++ b/crates/nix-eval/src/session.rs
@@ -225,6 +225,7 @@
 		flake: &OsStr,
 		extra_args: impl IntoIterator<Item = &OsStr>,
 		nix_system: String,
+		fail_fast: bool,
 	) -> Result<Self> {
 		let mut cmd = Command::new("nix");
 		cmd.arg("repl")
@@ -232,6 +233,9 @@
 			.arg(flake)
 			.arg("--log-format")
 			.arg("internal-json");
+		if !fail_fast {
+			cmd.arg("--keep-going");
+		}
 		for arg in extra_args {
 			cmd.arg(arg);
 		}
modifiedflake.nixdiffbeforeafterboth
136 inherit (packages) fleet-install-secrets;136 inherit (packages) fleet-install-secrets;
137 })137 })
138 // {138 // {
139 checks.formatting = treefmt.check self;139 formatting = treefmt.check self;
140 };140 };
141 # TODO: It should be possible to move lib.mkIf to default attribute, instead of disabling the whole141 # TODO: It should be possible to move lib.mkIf to default attribute, instead of disabling the whole
142 # devShells block, yet nix flake check fails here, due to no default shell found. It is nix or flake-parts bug?142 # devShells block, yet nix flake check fails here, due to no default shell found. It is nix or flake-parts bug?