···11+## nod
22+33+A simple self-contained daemon to gather statistics on Nix builds and substitutions using structured JSON logs.
44+55+## requirements
66+77+- nix 2.30 or later (for `json-log-path` support).
88+99+## building
1010+1111+``` bash
1212+cargo build --release
1313+```
1414+1515+## usage
1616+1717+First you must make sure the nod daemon is running.
1818+1919+```bash
2020+nod daemon
2121+```
2222+By default, it listens on `/tmp/nix-observability.sock` and stores data in `nix-obs.db`.
2323+2424+Then configure nix to output detailed trace logs to the socket.
2525+2626+Add the following to your `nix.conf` (usually `/etc/nix/nix.conf` or `~/.config/nix/nix.conf`):
2727+```text
2828+json-log-path = /tmp/nix-observability.sock
2929+```
3030+*Note: Ensure the Nix process has permissions to write to the socket.*
3131+3232+Just use Nix as usual:
3333+```bash
3434+nix build nixpkgs#hello
3535+```
3636+3737+Then view your stats:
3838+```bash
3939+nod stats
4040+```
4141+4242+## how?
4343+4444+The daemon uses the `json-log-path` feature introduced in Nix
4545+2.30. Instead of parsing the complex binary worker protocol, it
4646+consumes a structured stream of events directly from the Nix
4747+process. Relevant
4848+[code](https://github.com/NixOS/nix/blob/b4de973847370204cf28fe2092abdd21f25ee0e8/src/libutil/include/nix/util/logging.hh)