Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Determinate Nix installer #5

Open
vtu-dog opened this issue Mar 28, 2024 · 3 comments
Open

Determinate Nix installer #5

vtu-dog opened this issue Mar 28, 2024 · 3 comments

Comments

@vtu-dog
Copy link

vtu-dog commented Mar 28, 2024

Is your feature request related to a problem? Please describe.

When I started fiddling with Nix on macOS, my initial experience was quite horrible. I quickly made my setup barely usable and wanted to start over, only to be met with a plethora of problems when I tried to perform a complete uninstall.

It's way too easy to unwittingly enter a hellscape of your own creation. Here's what NOT to do, as evidenced by my struggles:

  1. Install nix using the official installer.
  2. Install nix-darwin, fiddle with random flakes and break stuff until you don't even know how to get out of the mess you've created.
  3. Uninstall nix using the official guide, hoping that you'll be able to start over. There are quite a few steps, and one of them involves editing fstab, so you better be careful. At this point I was sweating bullets, not fun.
  4. Try to reinstall nix, only for the installer to fail, because you didn't uninstall nix-darwin first.
  5. Nix-darwin cannot be uninstalled using the script they provided, because nix-build is no longer available. Good luck, you'll need it.

Once I managed to piece my OS back together, I reinstalled Nix using the Determinate Systems installer:

  • It provided me with an uninstall script, so I wouldn't have to jump through multiple hoops in case I wanted to start over.
  • It's also aware of existing nix-darwin installations and refuses to proceed if it detects one, so a beginner will have a much harder time bricking their setup.
  • Oh, and the installer enables flakes by default, which is neat.

Describe the solution you'd like

My experience with Nix on macOS would've been much smoother if I'd used the DS installer right off the bat. I think it deserves a mention alongside nix-darwin-kickstarter, since I can easily imagine a beginner running into the same footguns I did and deciding never to use Nix again.

Describe alternatives you've considered

I considered creating an appendix for macOS users, but I feel that just guiding them towards an alternative installer should be enough to alleviate most of the potential pain points.

@ryan4yin ryan4yin transferred this issue from ryan4yin/nixos-and-flakes-book Apr 2, 2024
@ryan4yin
Copy link
Owner

ryan4yin commented Apr 2, 2024

  1. Install nix using the official installer.

3. Uninstall nix using the official guide, hoping that you'll be able to start over. There are quite a few steps, and one of them involves editing fstab, so you better be careful. At this point I was sweating bullets, not fun.

That's indeed my feelings when I first started using Nix on macOS, that's why I recommended using the Determinate Nix Installer before: 29a4c81

But a few months ago I found the Determinate Nix Installer works not will with nix-darwin, I tried to fix that by submit a PR to nix-darwin: LnL7/nix-darwin#834.
But I did not figure out what exactly the problem is, and finally I closed the PR, and replace the Determinate Nix Installer by the official one(29a4c81), I never encountered this kind of issue again after the replacement.

Another problem I met is, the Determinate Nix Installer provides no docs for how to uninstall itself manually.
This will be a big issue when you use it with nix-darwin and try to manage nix itself via nix-darwin - /nix/nix-installer uninstall will not work properly, and you will have to dig into nix-installer's source code and state file to figure out how to uninstall it manually, which is painful.

2. Install nix-darwin, fiddle with random flakes and break stuff until you don't even know how to get out of the mess you've created.

  • Try to reinstall nix, only for the installer to fail, because you didn't uninstall nix-darwin first.

  • Nix-darwin cannot be uninstalled using the script they provided, because nix-build is no longer available. Good luck, you'll need it.

Yeah, nix-darwin modifies some of the core configurations of the macOS system, which is unnecessary and troublesome for people who only want to use nix for development environment management.
Nix-darwin should indeed be an option rather than a default, and I will find time to add relevant tips.

  • It provided me with an uninstall script, so I wouldn't have to jump through multiple hoops in case I wanted to start over.

  • It's also aware of existing nix-darwin installations and refuses to proceed if it detects one, so a beginner will have a much harder time bricking their setup.

  • Oh, and the installer enables flakes by default, which is neat.

This feature was added by DeterminateSystems/nix-installer#561, and docs for nix-darwin was added by DeterminateSystems/nix-installer#687.
These are good features or documentation additions, but they didn't exist when I first used nix-darwin & nix-installer last year.

But as I said above, I still think it's risky to use nix-darwin with the Determinate Nix Installer at present.

In summary, the Determinate Nix Installer is great if you're not going to use nix-darwin, I will add some docs for it.

@ryan4yin
Copy link
Owner

ryan4yin commented Apr 2, 2024

/cc @phromaj

@jjyr
Copy link

jjyr commented Apr 18, 2024

This issue saved my life.
I tried to follow the instructions in the document, but got stuck at the Nix installer step. It failed without a clear reason.
Then I found this issue and tried using the DS installer instead. Everything went smoothly! I would strongly recommend using the DS installer by default to prevent more people from encountering similar problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants