DeterminateSystems / nix-installer

Install Nix and flakes with the fast and reliable Determinate Nix Installer, with over 2 million installs.
GNU Lesser General Public License v2.1
2.08k stars 51 forks source link

Ability to upgrade nix-installer #1193

Open mirosval opened 5 days ago

mirosval commented 5 days ago

Hello and thank you for developing this software, it's an awesome improvement over the official Nix installer!

I have seen https://github.com/DeterminateSystems/nix-installer/issues/1164 which might seem like a duplicate, but would like to share my experience to try to motivate this differently or maybe learn something I didn't know.

I've had a very unpleasant experience recently and I believe this feature would go a long way in mitigating this in the future.

I'm using the nix installer on darwin with nix-darwin and home manager. The timeline of what happened is a bit sketchy here because I didn't expect it and so didn't take full notes:

  1. I had nix-installer v0.5 installed
  2. I've tried to add some new package and do a darwin switch
  3. I was unable to complete the switch and the error suggested upgrading nix
  4. I was not able to upgrade the nix-installer and so I did nix-installer uninstall
  5. I'd forgotten about the nix-darwin issue (which I know is fixed in later versions of nix-installer)
  6. Since the Alacritty, tmux, nvim and all the software I had installed via nix were running at the time, uninstalling nix caused them to all consume 100% CPU and the uninstall process to get stuck.
  7. Now I had a half-finished uninstall with the left over nix-darwin certificate issue, being unable to either complete the uninstall or start a new install. (Here it would be very helpful to have some tool in the nix-installer that can detect and help with this, because it took me embarrassingly long to find it in the readme)
  8. After deleting the darwin certs and reinstalling using nix-installer everything worked again.

I can see that these random issues, such as the current Sequoia ID issue keep cropping up and the newer versions of the nix-installer can deal with them better than the old versions. It would be awesome if we could take advantage of the new versions without having to completely reinstall nix every time.

grahamc commented 5 days ago

Thanks for the report, @mirosval.

For some background, nix-installer doesn't support upgrading to make the uninstall process as reliable as possible. Since we write out a receipt, we preserve the nix-installer binary to make sure that receipt can be parsed and reverted with the same semantics that created it. If we upgraded the nix-installer binary over time, maintaining that uninstall process becomes a much more challenging prospect -- likely involving a lot of code duplication whenever the steps changed. I think you know, this, though, from the other issue.

I do want to call out that the Sequioa repair command was deliberately made to be executable for users, no matter how they installed Nix, because of this limitation of nix-installer.

I also hear what you're saying here. That the process you went through was really painful, and whether you upgrade nix-installer or not, the important part is not having such a miserable experience. Any chance you could email me and we could talk a bit further about that?

mirosval commented 5 days ago

I wrote you an email, thank you for that!

Maybe one idea worth discussing here is to split the installer and the orthogonal tooling such that these repair jobs don't depend on the nix-installer but can be run separately?