-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macOS updates often break nix installation (updates replace path-hooks on multi-user install) #3616
Comments
If they keep updating these files, perhaps we should file an Apple Feedback report asking them to add Beyond that, the only automatic solution that comes to mind would be to have |
I have done a few days before the upgrade to Catalina 10.15.6... and today I wanted to install something to discover that my nix installation was gone!
So I don't care if the /etc/zshrc is or not overwritten in the future... I agree this is a bad solution, but at least for the time being my workaround... |
I filed feedback for Apple (FB8181728). In the meantime, |
Edit: this had its own problems and was reverted. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: |
I marked this as stale due to inactivity. → More info |
I'm still seeing this issue as of Nix 2.3.15 and Big Sur 11.5.2. The workaround is to re-add the following to # Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
source '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix |
Edit: I see in matrix that #3608 caused its own problems documented in #4169, so I guess a release would actually be a step in the wrong direction atm... Striking through the parts that may not actually be much help... FWIW this is roughly expected:
|
can't we just patch zsh to use different rcfile paths? users can then set the patched zsh as their shell with nix-darwin |
@ggPeti I assume it's ideal if it still works without Nix-darwin, but tbh I have no clue how big the set of (Nix + zsh - nix-darwin) uses is. #4169 seems to have a more robust discussion on ~zsh-specific fixes, and I'm trying to fish around for someone to add it to the 2.4 milestone; if I find someone, that might be a good place to pull on the thread... |
#4169 got closed without dealing with this part of the problem. |
I recently stumbled on a reference to someone saying they'd taken an update and had the update leave their modified items in place, and add the replaced items to the Relocated Items directory. I have a spare laptop on the beta release channel and wanted to try this out, so I took an update on it this afternoon to 11.5 and noticed two things:
I'm not sure if this means they're treating zsh init files differently since it's the default shell, or if it means they inadvertently left zshrc out of the list of files to respect instead of replace. Something to watch closely in the next few updates, I guess. |
I tried this with an update from 12.0 beta to 12.0.1 and, once again, zshrc was overwritten. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/nix-commands-missing-after-macos-12-1-version-upgrade/16679/5 |
And of course this happened again on 12.2. (@frlan) |
This comment was marked as off-topic.
This comment was marked as off-topic.
... please don't?!? |
Every macOS update breaks nix. It's clearly not ready for macOS. |
When trying to debug this problem for myself, I think I was misled by the current documentation. For example, this discussion of environment variables https://nixos.org/manual/nix/stable/installation/env-variables.html assumes a single-user installation. (I think?) And because I don't have |
Good catch. I think so. If none of the differences between the two scripts seem to fall within the scope of the current documentation, it might suffice to just say that each mode has a distinct script and list the path for each? |
That sounds reasonable to me |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/why-can-i-not-execute-a-new-version-of-nix-with-nix-shell/31032/1 |
For those who manually modified their user's [[ ! $(command -v nix) && -e "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh" ]] && source "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh" Otherwise, trying to test a new version of nix by using |
avoiding NixOS/nix#3616
The issue still persists on Sonoma 14.4 update. |
persists on Sonoma 14.5 upgrade. |
Has anyone considered/reviewed https://zero-to-nix.com/concepts/nix-installer ? Edit: It survived the 14.5 update without issue it seems, when using the installer by Determinate Systems. Its not the official one though and despite the company being heavily involved in nix, its not wrong to question thrust-worthiness when you curl a script and run it as root :) |
I use a Zero-to-Nix install on several Apple Silicon machines. It’s has survived several updates. |
This doesn't quite characterize it right. The DetSys installer does still modify shell profiles, but it also installs a launchd daemon (the plist) that runs
Yep! There's a slowly-progressing ~unofficial/experimental project in the NixOS org to work on a fork of the DetSys installer (fork mainly because the Nix team isn't yet on board with some of the ~opinionated differences between their installer and the canonical one, so we need to un-implement those or implement the official installer's approach if it differed). If that path leads to official adoption, we'll gain support for this that way. Since the DetSys installer is leaning on its own repair command for the business end of this, implementing the same feature for the official shell installer would be a lot more complex than it looks like at a glance. One of the DetSys installer's key design decisions here is keeping a receipt of what the installer did. Without that receipt, the shell installer's version of this would probably look like one of:
All of these are probably achievable, but they also smell like quite a lot of work to me. I also imagine the first two (~simpler) choices would be so slow that restoring terminal tabs with a zsh shell wouldn't have the fix when they load. My own limited energy is (at least for now) focused on getting the fork of the DetSys installer to the point where it's ~ripe for the Nix team to evaluate. (We're close. I've delayed making some requests around this since it isn't urgent and many of the people I need to bug have been focused on urgent governance stuff.) Around the same time as DetSys were adding this feature, I also opened a PR with a narrower (albeit weirder) workaround:
I'm a little cautious around both workarounds because they're "weird" in a (slightly different) way that might lead some people to worry their system is compromised. Graham's comment linked below and my response reflect on this property of both: I haven't leaned on my PR much because:
|
I have noticed that every once and a while
/Users/andrewmckinlay/.nix-profile/bin
and/nix/var/nix/profiles/default/bin
disappear from my$PATH
. The last time this happened, the hook nix installed was missing from/etc/zshrc
.Copying the following hook (copied from
/etc/bashrc
) to/etc/zshrc
and restarting the shell fixed everything again:My concern is that macOS updates will periodically overwrite
/etc/.zshrc
(and/etc/.bashrc
), requiring effort on my part to reinstall nix. For example, one macOS update overwrote the entire file to fix this misspelling:Both files are read-only anyway, should they really be written to by the nix installer?
The text was updated successfully, but these errors were encountered: