I run nix on both a workstation and a MacBook with the m1. It has worked great until recently every time I update the Mac the /nix folder get’s removed. I do still have the volume but it has the incorrect path. Any ideas why this is happening?
Since there’s some uncertainty here, and I don’t think we’ve had any other reports of fstab being wiped by a macOS update, I would start from the assumption that this is what you ran into if your shell is zsh.
If you do (use zsh) I’d recommend following the uninstall instructions and then reinstalling nix: Installing a Binary Distribution. (And, when future updates replace the zshrc, follow the steps in the issue linked above).
If Apple is actually wiping fstab, I would expect we’ll have corroborating reports soon.
Thanks for this, I did a reinstall and it remounted the /nix volume at the correct location. Not sure why that was happening but I appreciate all the help. Could be one of those “work security policy” things…
Ah. I guess that’s possible. It isn’t the case here, but I know we’ve had at least a report or two about people with work machines that have policies that preclude mounting a volume entirely. Report back if fstab disappears after the next update?
So far, I’ve only ever had to add these lines to the end of /etc/zshrc:
# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix
Just copy it out of /etc/bashrc. Then open a new shell.
Yeah that’s because the Nix store isn’t getting mounted. You need the correct fstab for that.
Mine looks like this:
#
# Warning - this file should only be modified with vifs(8)
#
# Failure to do so is unsupported and may be destructive.
#
UUID=EA40A961-526A-430D-AC1B-4302414FF135 /nix apfs rw,noauto,nobrowse,suid,owners
Obviously, you’d need to replace the UUID with your Nix volume’s.