I am on Macbook Pro M1 Monterey and I restarted by machine. Nix executables could not be found. So I did a search for them and found a whole bunch of them below.
So I want to know the default location for a fresh install of nix. Reinstalling is complicated so I would rather just try to reset the path variable. I would also suggest “Nix Store” with a space is a bit unusual place to find a bin directory.
I am assuming that the one I want is the 2.8.0 but I don’t recall seeing this in $PATH before.
If you rebooted because you updated macOS, the problem is probably, as nobbz mentions, Apple’s update overwriting /etc/zshrc. AFAIK they generally don’t clobber /etc/bashrc, so you can find a copy of the shell hook at the end of that file and re-add it to /etc/zshrc.
If you didn’t update macOS (which you comment about still seeing the hook in zshrc suggests), the problem is presumably that something else in your shell profile is overriding. This generally takes the form of something that runs before the shell hook aborting early, or something afterwards (often in your user profile) hard-setting the PATH instead of merely prepending/appending.
Actually… I’m probably getting ahead of us. The paths you’re citing (/System/Volumes/Data/Volumes/Nix Store) may mean something more fundamental isn’t working.
The store is on its own volume which should be mounted at /nix, so make sure you see /nix/store (i.e., run ls /nix/store). If not, the problem is probably whatever is keeping your store volume from mounting. Your shell hook may be fine.
Well I had two users on my Macbook one seems to have been created by Nix called Other then I added another admin user. When I rebooted it asked for admin permission because of multiple users being affected which I provided, and after that it seemed to have overwritten /etc/zshrc
/nix is now there but I don’t see anything under it
/nix % ls -la
drwxr-xr-x 2 root wheel 64 Apr 28 02:03 .
drwxr-xr-x 20 root wheel 640 Feb 26 14:05 .
What I recall is that fstab had /nix appearing just before or after apfs I think like below:
UUID=9D26308A-5246-4280-9DB2-10913B6FAA82 /nix apfs rw,noauto,nobrowse,suid,owners
I did modify this once during an uninstall but after that it reinstalled successfully and I had been using nix commands ok
Egh. So, what you’re seeing now is the empty mountpoint for the volume (created by macOS based on synthetic.conf). Since your volume isn’t mounted, there’s some kind of inconsistent state between fstab, the actual volume(s) on your system, and the mounting service script (stored in /Library/LaunchDaemons/org.nixos.darwin-store.plist).
You’re right that /nix should be present in the fstab between the UUID and apfs (and, yes–the instructions meant to remove the entire line).
We can keep trying to debug, but TBH it will probably be faster to follow the uninstall instructions at Installing a Binary Distribution again (with the complete removal of the line from fstab, and with an edit to the 7th step–just manually open Disk Utility and delete any/all volumes named Nix Store), and try a fresh install.
Ok, just wondering how does this affect the nix stores used in my existing project where I ran nix-shell? I think it downloaded lots of items over a few hours. Would those be lost on a reinstall? Not a huge loss, I am just curious if these stores are separate or not?