Whole file

Mic92/nix-fast-build

The author described this change as Fix --retries to re-run failed builds. It counts as a record because the check below fails on the code as it stood at 0a9328843 and passes on 70013796e, with nothing else changed between the two runs.

Fix saved2026-06-10
Sharing licenceMIT · LICENSE.md
Change size+11 7

What the code was meant to do, written into the code itself as a save note

Fix --retries to re-run failed builds

The change

3434 async def build(
3535 self,
3636 stack: AsyncExitStack,
37- build_output: IO[str],
37+ build_output: IO[bytes],
3838 opts: Options,
3939 nom_pipe: IO[bytes] | None = None,
4040 ) -> BuildResult:
4141 """Build and return BuildResult."""
42- proc = await stack.enter_async_context(
43- nix_build(self.attr, self.drv_path, build_output, opts, nom_pipe=nom_pipe)
44- )
45-
4642 rc = 0
47- for _ in range(opts.retries + 1):
43+ for attempt in range(opts.retries + 1):
44+ proc = await stack.enter_async_context(
45+ nix_build(
46+ self.attr, self.drv_path, build_output, opts, nom_pipe=nom_pipe
47+ )
48+ )
4849 rc = await proc.wait()
4950 if rc == 0:
5051 logger.debug(f"build {self.attr} succeeded")
5152 return BuildResult(return_code=rc, log_output="")
52- logger.warning(f"build {self.attr} exited with {rc}")
53+ logger.warning(
54+ f"build {self.attr} exited with {rc} "
55+ f"(attempt {attempt + 1}/{opts.retries + 1})"
56+ )
5357
5458 # If build failed, get the log using nix log
5559 log_output = await self.get_build_log(opts)

The check that tells the two apart

failpass·tests/test_retry.py::test_retry_reruns_build

Check file tests/test_retry.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it0a9328843837300949f05ff8d7c937053e1d9dc9
Broken version dated2026-06-10
Modulenix_fast_build.build
Units changedBuild
Fingerprint24aed55e59f4c6ad
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.