4 files changed
88 #[clap(long, default_value = env!("NIX_SYSTEM"))]88 #[clap(long, default_value = env!("NIX_SYSTEM"))]
89 pub local_system: String,89 pub local_system: String,
90
91
92
93
94
95 #[clap(long)]
96 pub fail_fast: bool,
90}97}
9198
92impl FleetOpts {99impl FleetOpts {
204 directory.as_os_str().to_owned(),211 directory.as_os_str().to_owned(),
205 nix_args.clone(),212 nix_args.clone(),
206 self.local_system.clone(),213 self.local_system.clone(),
214 self.fail_fast,
207 )215 )
208 .await?;216 .await?;
209 let nix_session = pool.get().await?;217 let nix_session = pool.get().await?;
--- 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> {
--- 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);
}
--- 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?