fix: stream build logs when -L is passed - #387
Merged
Merged
Conversation
Sereja313
force-pushed
the
sereja/fix-build-logs
branch
2 times, most recently
from
July 30, 2026 22:22
d4a7259 to
89acd6f
Compare
quentinmit
reviewed
Jul 31, 2026
Comment on lines
+245
to
+260
| fn enabled_build_logs(extra_build_args: &[String]) -> bool { | ||
| extra_build_args | ||
| .iter() | ||
| .any(|a| a == "-L" || a == "--print-build-logs") | ||
| } | ||
|
|
||
| fn drv_name(drv_path: &str) -> String { | ||
| let base = drv_path.rsplit('/').next().unwrap_or(drv_path); | ||
| let base = base.strip_suffix(".drv").unwrap_or(base); | ||
| let name_ver = base.split_once('-').map(|(_, r)| r).unwrap_or(base); | ||
| let bytes = name_ver.as_bytes(); | ||
| let cut = (0..bytes.len()) | ||
| .find(|&i| bytes[i] == b'-' && bytes.get(i + 1).is_some_and(u8::is_ascii_digit)) | ||
| .unwrap_or(name_ver.len()); | ||
| name_ver[..cut].to_string() | ||
| } |
There was a problem hiding this comment.
This feels very fragile - I think this is the only place where deploy has to parse the nix command line, and then you are doing a bunch of work to recreate similar log output to Nix.
Could you maybe get 99% of the way there just by modifying cli.rs to not set data.deploy_data.progressbar = Some(pb.clone()); when there are no remote builds? It looks like that would result in nix build's normal log output appearing on the terminal for local builds, which already are done synchronously.
Member
Author
There was a problem hiding this comment.
Fair point, I removed it everywhere except in the case of multiple remote builds.
Problem: The progress bar consumes nix's output, so local and single-host deploys lost native -L logs, errors and progress. Solution: Only show the spinner when building on multiple remote hosts at once, otherwise let nix write its native output directly.
Problem: With the spinner shown (2+ remote hosts), a failed build printed only a bare exit code, hiding nix's error. Solution: Print nix error/warning messages above the bar so failures show their reason.
Sereja313
force-pushed
the
sereja/fix-build-logs
branch
from
July 31, 2026 16:06
89acd6f to
0a3af8b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem: Recent async build feature broke -L/--print-build-logs.
Solution: When -L is set, stream each build-log line above the bar, prefixed with the derivation name like native
nix build -L.