On my raspberry pi (aka oliserver) I removed ~/.local but I forgot that nix profiles are stored there, and now I can't access my home manager packages (commands, terminfo etc.). Is there a way to restore the ~/.local/state/nix/profiles/profile symlink? I already tried switching the config again. I am using nixos module home manager with den.nix, dots are here
edit: solved by setting uninstall = true in home manager, switching, and rolling back
I would've thought that running switch again would put things back. But I might be able to help you out by sharing the structure of symlinks I have on my machine.
First, a couple of ideas to try. You probably lost your Nix user profile state in addition to Home Manager state. According to my searching I think some Nix commands should recreate the profile links for you. Try running
nix profile listand see if that puts anything back in~/.local/state/nix/profiles/. If it does that might get you to a point where running switch will get you going again.Another idea: Home Manager generations have store paths that look like this:
Each of those has an executable called
activate. Running one of those might get you set up again - possibly in a pretty old generation. I think that's a procedure you can normally use to roll back to a previous generation. I'd find a store path ending inhome-manager-generation, and give it a go.I have
~/.nix-profilelinked to/home/jesse/.local/state/nix/profiles/profile. I believe that's the Nix / NixOS user profile rather than Home Manager specifically, but I think that's an important piece.You're probably aware, but you can recreate that and other links with commands like
ln -s $HOME/.local/state/nix/profiles/profile $HOME/.nix-profile.My Nix state in
.localis in~/.local/state/nix/profiles/which has content like this:So that's both Home Manager generations, and Nix user profile generations. All symlinks, or symlinks to symlinks. I don't know if the generation number is stored in state somewhere. You might be able to pick an arbitrary number, pick an arbitrary home-manager-generation store path, and create the corresponding chain of two symlinks.
save