Reinitialize Nix after /nix/store is destroyed


How can I set Nix back to work? The system isn’t NixOS (Manjaro)

What exactly happened?

If all of your environments were declarative, you can simply uninstall Nix and then install it via the official installer again. Then rebuild your environments.

My Nix is installed from the Arch repo (1.1 Native). I tried to reinstall it, but no luck. It still expects something in /nix/store (which is empty):

+ sudo systemctl start nix-daemon
+ nix-channel --add
+ nix-channel --update
unpacking channels...
error: opening file '/nix/store/cgw5ci9s1596m8ripyyaral802cqg77h-nixpkgs.drv': No such file or directory
error: program '/usr/bin/nix-env' failed with exit code 1

Isn’t there some database which isn’t properly deleted?

sudo rm -rf /nix

is the answer. Then one can reinstall Nix.

Please use the upstream or detsys installer. I don’t get the point of using another distro’s package for Nix.