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
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 /// By default fleet continues on single derivation build failure
92 /// this flag makes command fail immediately
93 ///
94 /// Opposite of Nix's --keep-going
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?;
modifiedcrates/nix-eval/src/pool.rsdiffbeforeafterboth
12 pub async fn new(flake: OsString, nix_args: Vec<OsString>, nix_system: String) -> Result<Self> {12 pub async fn new(
13 flake: OsString,
14 nix_args: Vec<OsString>,
15 nix_system: String,
16 fail_fast: bool,
17 ) -> Result<Self> {
13 let inner = tokio::task::block_in_place(|| {18 let inner = tokio::task::block_in_place(|| {
14 r2d2::Builder::<NixSessionPoolInner>::new()19 r2d2::Builder::<NixSessionPoolInner>::new()
17 flake,22 flake,
18 nix_args,23 nix_args,
19 nix_system,24 nix_system,
25 fail_fast,
20 })26 })
21 })?;27 })?;
22 Ok(Self(inner))28 Ok(Self(inner))
30pub(crate) struct NixSessionPoolInner {36pub(crate) struct NixSessionPoolInner {
31 flake: OsString,37 flake: OsString,
32 nix_args: Vec<OsString>,38 nix_args: Vec<OsString>,
39 fail_fast: bool,
33 pub(crate) nix_system: String,40 pub(crate) nix_system: String,
34}41}
3542
41 .get()48 .get()
42 .expect("missed tokio runtime init!")49 .expect("missed tokio runtime init!")
43 .enter();50 .enter();
44 Ok(futures::executor::block_on(NixSessionInner::new(51 futures::executor::block_on(NixSessionInner::new(
45 self.flake.as_os_str(),52 self.flake.as_os_str(),
46 self.nix_args.iter().map(OsString::as_os_str),53 self.nix_args.iter().map(OsString::as_os_str),
47 self.nix_system.clone(),54 self.nix_system.clone(),
55 self.fail_fast,
48 ))?)56 ))
49 }57 }
5058
51 fn is_valid(&self, conn: &mut Self::Connection) -> std::result::Result<(), Self::Error> {59 fn is_valid(&self, conn: &mut Self::Connection) -> std::result::Result<(), Self::Error> {
modifiedcrates/nix-eval/src/session.rsdiffbeforeafterboth
225 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 }
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?