Nix on MacOS now fails because I set `auto-allocate-uids = true` like an idiot

Hello everyone.
I’ve been using nix with nix-darwin to manage my Mac system for the past month.

My setup is as follows:
macOS Sonoma version 14.3.1
Nix downloaded using The Determinate Nix Installer
Nix-Darwin downloaded using Flake installation.

Last night I was browsing github and looking at various darwin nix configurations and came across this repo that sets

    extraOptions = ''
      extra-nix-path = nixpkgs=flake:nixpkgs
      auto-allocate-uids = true             <--- the big problem!!!
      build-users-group = nixbld
      experimental-features = nix-command flakes auto-allocate-uids
    '';

Ever since I added this extraOption and rebuilt my system using darwin-rebuild switch --flake ~/PATH/TO/MY-NIX-DARWIN-CONFIG/ I can no longer do anything using the nix cli.

❯ darwin-rebuild switch --flake ~/PATH/TO/MY-NIX-DARWIN-CONFIG/
building the system configuration...
error: experimental Nix feature 'auto-allocate-uids' is disabled; use '--extra-experimental-features auto-allocate-uids' to override

❯ nix develop
error: experimental Nix feature 'auto-allocate-uids' is disabled; use '--extra-experimental-features auto-allocate-uids' to override

I found this github PR related to the experimental feature auto-uid-allocation which states:

No, this will never work on macOS since it requires cgroups.

My current state is that the programs I’ve previously installed work. But I cannot update my computer using nix in any way - no new programs, no flake updates, no darwin configuration changes, etc. So my laptop is not bricked. It just is in stasis and I need to use conventional package management for my applications. And dev environments no longer work (rip nix develop).

So now I’m wondering what are my options?
Here are some things I’ve tried that have not worked:

  • I removed auto-allocate-uids = true from my config.
  • I tried passing --extra-experimental-features auto-allocate-uids flag with my nix commands.
  • I tried uninstalling nix to start from scratch and reinstall but this error keeps me from using the nix cli at all so I am unable to uninstall.
  • I tried manually updating my nix.conf file in the nix store where the current symlink of /etc/static/nix/nix.conf points to.

Is there any way to get past this? Any help would be greatly appreciated. I really love nix and am devastated that I broke it.

Manually updating nix.conf should work, with the caveat that you should restart the nix daemon for it to take effect.

sudo launchctl stop org.nixos.nix-daemon
sudo launchctl start org.nixos.nix-daemon

@mrene

OMG I love you.

That worked. Thanks so much.

For anyone in the future who borks their system in a similar fashion, the fix was:

  1. use ls -alh /etc/static/nix/nix.conf and follow the symlinks to find the source location of nix.conf in the nix store.
  2. update this file in the store by removing auto-allocate-uids = true if it’s there (it’s read only by default so you will have to adjust the privileges save your changes).
  3. restart the nix daemon
sudo launchctl stop org.nixos.nix-daemon
sudo launchctl start org.nixos.nix-daemon

Can you post your flake file? I’m trying to get a similar setup working…

This sounds very off-topic to the thread at hand – consider making a new one? Also, see nix-darwin’s documentation on the subject.