Skip to content

[RFC 0196] Self-describing store#196

Open
roberth wants to merge 2 commits into
NixOS:masterfrom
roberth:self-describing-store
Open

[RFC 0196] Self-describing store#196
roberth wants to merge 2 commits into
NixOS:masterfrom
roberth:self-describing-store

Conversation

@roberth
Copy link
Copy Markdown
Member

@roberth roberth commented Jan 18, 2026

This RFC proposes that stores provide a nix-store.json file declaring their properties, enabling:

  • Discovery of store settings (storeDir, encoding, etc.)
  • Forward compatibility through explicit feature requirements
  • A unified replacement for the ad hoc nix-cache-info format

Rendered: https://github.com/roberth/rfcs/blob/self-describing-store/rfcs/0196-self-describing-store.md

Shepherd nominations welcome!

@roberth roberth changed the title RFC 0196: Start RFC about nix-store.json [RFC 0196]: Self-describing store Jan 18, 2026
@roberth roberth changed the title [RFC 0196]: Self-describing store [RFC 0196] Self-describing store Jan 18, 2026
as well as slightly reduce the number of requests.
The details of such an integration would be decided by those involved with RFC 195.

## Concrete example: the case hack
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing two very simple examples, a directory containing NARInfo files and NAR files (with whatever compression), and the one at ../../var/nix/db/nix-store.json.

There's arguably a big difference to storing Nars or unpacked files, and I feel like we're missing some format field of some sort. It doesn't map nicely to the more additive nature of features.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is also filesystem object encoding like casehack?

Copy link
Copy Markdown
Member Author

@roberth roberth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarification: store state and metadata, not all settings.

```

## Fields

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following list of fields is exhaustive until new fields are specified in follow-up RFCs.
Unspecified fields MUST be ignored.
Instead, fields that are essential to the store's integrity should be specified, and settings that are not should be handled through other means, such as the client's configuration system.

E.g. Nix local store has options that are implementation-specific or not even applicable:

  • build-dir: Nix settings currently combine some build settings into the store. They're correlated but only as an implementation detail.
  • use-roots-daemon: has little bearing on the store storage and it can continue to live in nix.conf
  • real (implied in the context of nix-store.json, as the client knows where it is)

## Metadata file

Stores provide a `nix-store.json` file containing metadata in JSON format.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This file should be regarded as persistent state of the underlying store representation rather than a configuration file.

Stores provide a `nix-store.json` file containing metadata in JSON format.

```json
{
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it should even include:

Suggested change
{
{
"_comment": "DO NOT EDIT THIS FILE BY HAND. Doing so may violate invariants that cause the store to be corrupted.",

Comment on lines +132 to +133
"wantMassQuery": true,
"priority": 40
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth noting that these were grandfathered in.

Especially priority should have been client-side configuration.
It is weird and of questionable utility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants