Nix Observability Daemon
observability nix
Rust 90.3%
Nix 9.7%
19 1 0

Clone this repository

https://tangled.org/bergsoe.net/nod https://tangled.org/did:plc:kfsvhhlldwjrbr6d2srbgzh7/nod
git@tangled.org:bergsoe.net/nod git@tangled.org:did:plc:kfsvhhlldwjrbr6d2srbgzh7/nod

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

nod#

A simple daemon that collects Nix build and substitution statistics using structured JSON logs.

requirements#

  • Nix 2.30 or later (json-log-path support)

building#

cargo build --release

usage#

Start the daemon:

nod daemon

Point Nix at the socket in nix.conf:

json-log-path = /run/user/1000/nod/nod.sock

Then use Nix normally. View accumulated stats with:

nod stats          # all time
nod stats -d 7     # last 7 days
nod stats -m 3     # last 3 months
nod stats -y 1     # last year
nod clean          # reset the database

configuration#

flag env default
--socket NOD_SOCKET $XDG_RUNTIME_DIR/nod/nod.sock
--db NOD_DB $XDG_DATA_HOME/nod/nod.db

Both directories are created automatically. The socket path in nix.conf must match --socket.

how?#

Nix 2.30 added json-log-path, which writes a stream of structured activity events (start/result/stop) to a file or Unix socket while a build runs. nod listens on that socket, tracks in-flight activities by ID, and on each stop event inserts a completed row into a local SQLite database. nod stats queries that database through the daemon.

Relevant Nix source: logging.hh