-
Notifications
You must be signed in to change notification settings - Fork 38
Description
Consider this flake:
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = inputs: {
packages.x86_64-linux.default = inputs.nixpkgs.legacyPackages.x86_64-linux.stdenv.mkDerivation {
name = "failing-package";
preUnpack = builtins.trace "about to unpack" ''
echo The build failed, foo, bar, baz.
exit 1
'';
};
};
}Running nom build will produce this output:
fetching path input 'path:/home/gep/nom-sticky-traces-repro'
trace: about to unpack
this derivation will be built:
/nix/store/x07zj26gqrz83xasfdgfd0wrxzccf452-failing-package.drv
failing-package> building '/nix/store/x07zj26gqrz83xasfdgfd0wrxzccf452-failing-package.drv'
failing-package> Running phase: unpackPhase
failing-package> The build failed, foo, bar, baz.
error: builder for '/nix/store/x07zj26gqrz83xasfdgfd0wrxzccf452-failing-package.drv' failed with exit code 1;
last 2 log lines:
> Running phase: unpackPhase
> The build failed, foo, bar, baz.
For full logs, run 'nix log /nix/store/x07zj26gqrz83xasfdgfd0wrxzccf452-failing-package.drv'.
┏━ 1 Errors:
┃ error: builder for '/nix/store/x07zj26gqrz83xasfdgfd0wrxzccf452-failing-package.drv' failed with exit code 1;
┃ last 2 log lines:
┃ > Running phase: unpackPhase
┃ > The build failed, foo, bar, baz.
┃ For full logs, run 'nix log /nix/store/x07zj26gqrz83xasfdgfd0wrxzccf452-failing-package.drv'.
┣━ 1 Traces:
┃ trace: about to unpack
┣━ Dependency Graph:
┃ ⚠ failing-package failed with exit code 1 after ⏱ 0s in unpackPhase
┣━━━
┗━ ∑ ⚠ Exited after 1 build failures at 18:29:49 after 0sNotice that the error message is printed 3 times and the trace is printed 2 times. When the error is much larger, the last 2 truncated error messages are rarely useful, it is only an annoyance and I always scroll up for the useful parts of the error. When running longer builds, the bottom "sticky errors and traces" take up a lot of space from the fancy build graph. I'm not saying it should be removed, it's pretty useful for showing traces like deprecations.
I'd love to see a flag that turns off the those sticky errors and traces, (and from Nix's side a flag to skip printing the 2nd errors). For example --no-sticky-messages could turn off #132.
Related:
- nh displays duplicate error messages during build failures while nixos-build shows single message #177
- Can’t see running builds when there are too many errors #142
Thanks for this awesome tool, without it estimating how long Nix builds will take be much harder and I enjoy watching the tree of builds :)