packages/core: revise readme; elaborate on supported Nix impls

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ibff4509c97cc205854ecab05320618f06a6a6964
This commit is contained in:
raf 2026-04-16 09:39:26 +03:00
commit 55f6a43dc2
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF

View file

@ -1,7 +1,11 @@
# @ns/core
Core types and parsing logic for Nix evaluator statistics. This package is
framework-agnostic and can be used in any JavaScript/TypeScript environment.
Core types, parsing logic for Nix evaluator statistics, and various bits from
the web component that the CLI may interact with in the future. The `@ns/core`
package contains the truly "generic" logic that can be used around the
workspace, or even outside it. This package is framework-agnostic and can be
used in any JavaScript/TypeScript environment. Which is to say that you can use
it to make your own statistics viewer without doing any heavy lifting.
## Usage
@ -20,8 +24,14 @@ const change = calculateChange(stats.nrThunks, previousStats.nrThunks);
console.log(`Thunks changed by ${change.percent.toFixed(2)}%`);
```
## Version Compatibility
## Nix Version/Implementation Compatibility
The parser handles different Nix implementations (Nix, Lix, Snix, etc.) by
checking for field existence in the raw JSON, since not all implementations
expose the same statistics.
There are currently 4 competing implementations of Nix, and only two of those
are considered first-class. The parser handles different implementations the
best it can by checking the field existence in the raw JSON, but it is not able
to handle new fields. It is unfortunate that not all implementations expose the
same statistics.
Worth noting that besides Lix and Nix, there are and will likely be more
implementations. If you want _yours_ to be supported as a first class citizen,
please submit a pull request.