difftreelog
feat adopt keep-going-by-default behavior
in: trunk
4 files changed
crates/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?;
crates/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> {
crates/nix-eval/src/session.rsdiffbeforeafterboth225 flake: &OsStr,225 flake: &OsStr,226 extra_args: impl IntoIterator<Item = &OsStr>,226 extra_args: impl IntoIterator<Item = &OsStr>,227 nix_system: String,227 nix_system: String,228 fail_fast: bool,228 ) -> Result<Self> {229 ) -> Result<Self> {229 let mut cmd = Command::new("nix");230 let mut cmd = Command::new("nix");230 cmd.arg("repl")231 cmd.arg("repl")231 .args(["--option", "pure-eval", "true"])232 .args(["--option", "pure-eval", "true"])232 .arg(flake)233 .arg(flake)233 .arg("--log-format")234 .arg("--log-format")234 .arg("internal-json");235 .arg("internal-json");236 if !fail_fast {237 cmd.arg("--keep-going");238 }235 for arg in extra_args {239 for arg in extra_args {236 cmd.arg(arg);240 cmd.arg(arg);237 }241 }flake.nixdiffbeforeafterboth--- a/flake.nix
+++ b/flake.nix
@@ -136,7 +136,7 @@
inherit (packages) fleet-install-secrets;
})
// {
- checks.formatting = treefmt.check self;
+ formatting = treefmt.check self;
};
# TODO: It should be possible to move lib.mkIf to default attribute, instead of disabling the whole
# devShells block, yet nix flake check fails here, due to no default shell found. It is nix or flake-parts bug?