Pipe your nix-build output through the nix-output-monitor (aka nom) to get additional information while building.
This is an experimental fun project. You are free and very welcome to contribute feedback, issues or PRs, but I do not commit to maintain this project over a long time period. This program relies on the output of the v1 nix commands (i.e. nix-build not nix build) and will hopefully one day be obsolete.
Best case scenario: This could serve as inspiration as to how to improve nix output in the future.
- cabal: Install
cabal installin the checked out repo.
- nix: or run
nix-envor include the
default.nixof this repo in your nixos config.
Once you have installed
nix-output-monitor to your path, run any nix command (
home-manager switch, not
nix build.) and pipe stderr and stdout into
nix-build 2>&1 | nom
Don‘t forget to redirect stderr, too. That's what the 2>&1, does.
The recording is a bit laggy, but after a rewrite of the printing timing it is super smooth and readable.
With some local builds and downloads:
With more builds on a remote server:
The program consists of three steps in a loop, powered by Haskell lazyness.
- parsing (If you have suggestion for improving my parser combinators, I am all ears!)
- updating state (with IO to look into the the nix store.)
Right now it uses three sources of information:
- The parsed nix-build output
- it checks if build results exist in the nix-store
- it querys
.drvfiles for information about the
This will fail in unexpected and expected ways. nix-output-monitor receives most it's information from parsing nix-build output. The parser might be to strict or to loose for use cases I didn‘t think of. Then the numbers displayed will be off!
Terminal clearing and reprinting is brittle. It might fail with your terminal or terminal width. This program also makes assumptions like your nix-store is at "/nix/store" or that every derivation has an output at "out".
The formatting code is a mess and has no tests, so feel free to tell me about any corner cases where it breaks.
Luckily I don‘t think this program screws up anything more than your terminal.
The biggest strength of nom are ovbiously the colorful unicode symbols! (If you don‘t agree I accept PRs to making that configurable.)
nom ignores any output it doesn‘t recognize and will always print out everything it receives. So you can never loose information (besides coloring of nix output).
nom does not assume that you run exactly one nix-build. If you run e.g. a script running multiple builds it will aggregate the information of all of them.