didn’t work. So I thought I need to delete the cache. Unfortunately I was too reckless and didn’t make a backup of the DB. So, is there a way to recreate the database? Also, HOW to upgrade to a new version? This should be easy to find, but it isn’t, it was a pain the last time as well.
ls /nix/var/nix/db/
big-lock db.sqlite-shm db.sqlite-wal reserved schema
Edit: I was looking for the path with search, but by looking for Nix database I found some hints.
This seems to be a bigger issue with that database getting corrupted and it’s not easy to recreate.
I also didn’t know that I should backup /nix/var, /nix contains the store.
The nix db contains state not available from the store itself, regarding things like where the data came from and why it should (or shouldn’t) be trusted. That’s why it exists. You can just tell it to blindly trust everything it stumbles across, but that’s not a restoration, even though it functions. I know the nixos install media do something similar since they’re essentially “creating” a prepopulated store.
I really do recommend obliterating /nix/store and building your system over again with nixos-install. Everything in /nix/store should be completely replaceable so long as you still have the nix expressions it was built with. Everything untouched by a normal nixos-rebuild is also untouched by this process (except that nixos-install will install the bootloader, anyway). Trying to save your store is going at things backwards. The store is fundamentally a cache. Regenerate it.
I’m still reading through the discussion on Github, and won’t make a decission before I’m done with it.
In regards to the db you kinda refuted your own point. Since everything installed is something I already trusted, there’s no reason to not just put it back into the db.
Anyways, if I can really just rest restore the store, maybe I’ll do that. It’s still absurd, though.
Great, you just derailed the conversation. If you don’t want to help, then don’t post here.
Obviously I didn’t know that the db was “the source-of-truth”.
Absurd is it to me that I still have all the store, but the db was everything, but it also has no automatic backup. I still didn’t get an explanation why it’s such a big deal that the db is gone, when I’m trusting the store.