I installed nix on macOS recently, and was happily working through the Nix Pills series. I noticed that while I had the correct environment variables set like NIX_PATH, the install only looks for bash profiles to update, so my ~/.zshrc wasn’t touched. Consequently, after a macOS upgrade and reboot I’m missing those environment variables and their default values.
Can someone please enlightenment as to what environment variables should be set and to what values? I performed a multi-user deamon install. So I believe I need NIX_REMOTE=deamon, but I’m not sure where to point NIX_PATH to, or if I need to update PATH. Thanks.
Okay, I took a look, and it wasn’t eval, its been a simple sourcing of another file. I’m not sure what the suggested line from the installer was, but as I use a single config for all my machines, I modified it to look like this:
Hrmm perhaps I’ll attempt a reinstall. Although that does sound like a Windows solution! But it is quick and easy. The thing is, I don’t even have a /etc/profile.d/ directory, never mind a nix.sh script.
In /etc I have zshrc.backup-before-nix but zshrc itself is identical to that file, so it looks like the install didn’t actually modify something it was intending to. I’ve got a ~/.bashrc and a ~/.bash_profile but I’ve never actually logged into a bash session because it’s a clean Catalina install so it’s straight into zsh. And even those bash config files are untouched.
It would be more useful if the installer could cater for the minor difference in using Zsh. #justsaying
Saw that earlier. He was having issues with the daemon. There’s actually a long GitHub thread that addresses that issue and a few others, all of which I went through and got working during the install I did.
What I have discovered was missing, (and I can’t prove that is was this morning’s macOS upgrade I performed that deleted it, but I can’t see any other reason for the removal) was from the end of /etc/zsrch.
# 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
That nix-daemon.sh script is responsible for setting all my nix environment variables, so that’s why I ended up in this state. I can only assume it was the macOS upgrade that overwrote it. I didn’t touch it. Didn’t even know it was there until today. :-/