maralorn / nix-output-monitor

Pipe your nix-build output through the nix-output-monitor a.k.a nom to get additional information while building.
GNU Affero General Public License v3.0
916 stars 27 forks source link

Paths from --print-out-paths are swallowed into stderr, unless wrapper is used #149

Open cab404 opened 1 month ago

cab404 commented 1 month ago

(nushell is used cause output is nice)

(nix "build" "nixpkgs#hello" "--log-format" "internal-json" --print-out-paths o+e>| nom --json) | complete
╭───────────┬──────────────────────────────────────────────────────────╮
│ stdout    │                                                          │
│ stderr    │ /nix/store/kwmqk7ygvhypxadsdaai27gl6qfxv7za-hello-2.12.1 │
│           │ Finished at 23:57:05 after 0s                            │
│           │                                                          │
│ exit_code │ 0                                                        │
╰───────────┴──────────────────────────────────────────────────────────╯

(nom "build" "nixpkgs#hello" "--log-format" "internal-json" --print-out-paths) | complete
╭───────────┬──────────────────────────────────────────────────────────╮
│ stdout    │ /nix/store/kwmqk7ygvhypxadsdaai27gl6qfxv7za-hello-2.12.1 │
│           │                                                          │
│ stderr    │ Finished at 23:57:32 after 0s                            │
│           │                                                          │
│ exit_code │ 0                                                        │
╰───────────┴──────────────────────────────────────────────────────────╯

It should probably be possible to just print out non-json stuff from stdin to stdout instead of stderr? I am not sure if it will break anything.

maralorn commented 1 month ago

Problems like this are one of the reasons that I prefer the wrapper.

The problem is that nom can’t tell which part of the input were stdout and which ones stderr.

I honestly forgot. Have you tried what happens if stdout is not passed to nom?

cab404 commented 1 month ago

Problems like this are one of the reasons that I prefer the wrapper.

Wrapper is nice as long as I don't receive everything over ssh. Can I specify what to wrap?

maralorn commented 1 month ago

No, not currently. The main point of the wrapper was that it can add some flags to nix-build without you needing to worry about it.