nix-output-monitor icon indicating copy to clipboard operation
nix-output-monitor copied to clipboard

Trace messages are lost

Open viperML opened this issue 1 year ago • 1 comments

When piping both stdout and stderr to nom, nom doesn't print back the trace messages:

$ nix build --no-eval-cache /home/ayats/Documents/dotfiles#nixosConfigurations."hermes".config.system.build.toplevel

trace: nix-2.18.1 reached desired version 2.14.0
trace: warning: The option `services.avahi.nssmdns' defined in `/nix/store/kfblblk8pvjbdip1c9r6k3c2abdn4d1r-source/hosts/hermes/configuration.nix' has been renamed to `services.avahi.nssmdns4'.
$ nix build --no-eval-cache --log-format internal-json /home/ayats/Documents/dotfiles#nixosConfigurations."hermes".config.system.build.toplevel |& nom --json

Finished at 19:12:48 after 7s

Related: https://github.com/viperML/nh/issues/64

viperML avatar Jan 29 '24 18:01 viperML

Yes, that’s a known issue, but we need to fix it. I often go far to long without noticing certain warnings.

maralorn avatar Jan 29 '24 21:01 maralorn

I don't know what I'm doing, but I took a crack at this in 738f445082d6d5c8f96701ccd1fe1136a7a47715.

A simple example of the output:

 :; nix -L --log-format internal-json eval --raw --expr 'builtins.trace "some trace message" ""' |& ./result/bin/nom --json
trace: some trace message
┏━ 1 Traces: 
┃ trace: some trace message
┣━━━                                                            
┗━ ∑ ⚠ Exited with 1 traces reported by nix at 16:47:35 after 0s

For a more complicated example with NixOS module warnings (which is the main thing I was originally interested in fixing):

https://github.com/maralorn/nix-output-monitor/assets/54726391/67996707-50ab-4ad7-8ff3-81f33575f396

(built from this flake: https://github.com/daniel-sampliner/nix-output-monitor/blob/nixos-warning-example/flake.nix)

daniel-sampliner avatar Mar 31 '24 23:03 daniel-sampliner

Github says that "video can't be plated because the file is corrupt"

viperML avatar Apr 02 '24 10:04 viperML

Odd. I must have used funky ffmpeg seetings since that plays fine for me on my computer. Does this work:

cast

I don't think static output does it full justice, but this is what the end results look like when building that flake:

┏━ 52 Traces: 
 ⋮ 
┃ trace: warning: nixos module warning #34
┃ trace: warning: nixos module warning #35
┃ trace: warning: nixos module warning #36
┃ trace: warning: nixos module warning #37
┃ trace: warning: nixos module warning #38
┃ trace: warning: nixos module warning #39
┃ trace: warning: nixos module warning #40
┃ trace: warning: nixos module warning #41
┃ trace: warning: nixos module warning #42
┃ trace: warning: nixos module warning #43
┃ trace: warning: nixos module warning #44
┃ trace: warning: nixos module warning #45
┃ trace: warning: nixos module warning #46
┃ trace: warning: nixos module warning #47
┃ trace: warning: nixos module warning #48
┃ trace: warning: nixos module warning #49
┃ trace: warning: nixos module warning #50
┣━ Dependency Graph:
┃    ┌─ ✔ etc-bashrc 
┃    │  ┌─ ✔ unit-dbus.service 
┃    ├─ ✔ user-units 
┃    │     ┌─ ✔ reload-container 
┃    │  ┌─ ✔ unit-container-.service 
┃    │  │              ┌─ ✔ perl-5.38.0-env ⏱ 2s
┃    │  │           ┌─ ✔ command-not-found 
┃    │  │        ┌─ ✔ system-path ⏱ 1s
┃    │  │     ┌─ ✔ dbus-1 
┃    │  │  ┌─ ✔ X-Restart-Triggers-dbus 
┃    │  ├─ ✔ unit-dbus.service 
┃    ├─ ✔ system-units 
┃ ┌─ ✔ etc 
┃ ✔ nixos-system-nixos-23.11.20231129.057f9ae 
┗━ ∑ ⏵ 0 │ ✔ 228 │ ⏸ 0 │ ↓ 0 │ ↓ 371 │ ⏸ 0 │ ⚠ Exited with 52 traces reported b…

daniel-sampliner avatar Apr 02 '24 12:04 daniel-sampliner

LGTM, very cool :+1:

viperML avatar Apr 02 '24 14:04 viperML