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

So, has someone built something neat with this? I still haven’t managed to kick the tires on it yet.

I tried this following the doc here Experimental Local Overlay Store - Nix Reference Manual. I get this errrors:

performing a single-user installation of Nix...
copying Nix to /nix/store....................................................
replacing old 'nix-2.22.1'
installing 'nix-2.22.1'
error:
       … while setting up the build environment

       error: getting attributes of path '/mnt/wsl/nix/ocean_store/merged_store/nix/store/1rkhjf55x59w6qm1pbhf80ks2wjpg973-libcpuid-0.6.4': No such file or directory
/tmp/nix-binary-tarball-unpack.XxvibFZjgI/unpack/nix-2.22.1-x86_64-linux/install: unable to install Nix into your default profile

It seems the install script still use the /nix/store , but when the path is different from the store option in the ~/.config/nix/nix.conf, which is setted to use the local (overlay) store. I tried these 2 stores both failed.
IS IT POSSIBLE to have a store different to nix/store or real physical storage different to ‘nix/store’?

Can you share your nix config and mount/findmnt output?

I don’t understand that error because it looks like the installer? But those instructions don’t mention the installer.

Hey team,
I have raised an issue with my attempt to use local-overlay store.

@ryantm Ryan, it would be great if you can take a look there. Seems you have good experience with local-overlay.
Thank you in advance

1 Like