I have permission issues one macos with nix and home-manager.
Sometimes I got db error,
building the system configuration...
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: the store is not owned by this user, but /nix/var/nix/db is writable
If you are using the daemon:
sudo chown -R /nix/var/nix/db
make: *** [mac_switch] Error 2
Sometimes I got permission errors on drv.lock files.
There may be others, but I recall two cases that might apply here:
If you have a single-user install and have been running Nix commands with sudo. The commands would work–but leave some files with root ownership around, which start causing problems when you run nix commands as your user. If you’ve done this, taking ownership and avoiding it in the future is right.
If you used a daemon install, but for some reason your Nix daemon isn’t/wasn’t running. You should be able to confirm this with launchctl, but I don’t recall the syntax off the top of my head.