Super Colliding Nix Stores

Yes one should never need to read an RFC or implementation PR as the only option to figure out how something works, of course!

All store types have user-facing documentation, this one included.

It will appear in Store Types - Nix Reference Manual soon once hydra catches up

In the meantime, you can read the source markdown: nix/src/libstore/local-overlay-store.md at master · NixOS/nix · GitHub

6 Likes

The local overlay store is now used in every Replit container, so you could inspect what is going on there to see it in action:

$ cat /etc/nix/nix.conf 
experimental-features = nix-command flakes local-overlay-store read-only-local-store
store = local-overlay?lower-store=%2Fmnt%2Fcacache%3Fread-only%3Dtrue&upper-layer=/mnt/nix/store&check-mount=false
gc-reserved-space = 0

$ mount | grep /nix/store
overlay on /nix/store type overlay (rw,relatime,lowerdir=/mnt/cacache/nix/store:/mnt/nixmodules/nix/store:/nix/store,upperdir=/mnt/nix/store,workdir=/mnt/nix/work/store,xino=off,nouserxattr)

/mnt/nix is the upper persistent nix store, and /mnt/cacache/nix/ is the lower store.

6 Likes

Why is only one of the store paths URL-escaped?

I don’t understand from “Lower metadata source:” on the linked documentation how the metadata source is configured. It says:

This is abstract, just some way to read the metadata of lower store store objects. For example it could be a SQLite database […]

It’s not clear from these docs what the options are for providing the lower metadata?

It also says of “Lower store directory”:

Specified with lower-store.real setting.

However I didn’t find any examples of this being used?

Thanks for the feedback, @pwaller! I tried to address all your questions in Improve `local-overlay` docs in a few ways by Ericson2314 · Pull Request #10502 · NixOS/nix · GitHub. Do let me know if that makes it clear now.

2 Likes