-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
zsh.dotDir breaks homebrew, removing nix-darwin's homebrew from the PATH #6483
Comments
CC @sudoforge because I didn't fill out the CC section before creating the issue. I don't think it pings after an edit, where I added the CC info. |
it does - or at least, i received an email notification of the comment. can you provide a working reproduction of your issue? at first glance, i'm not following the logic behind the issue report here. |
Is there a simple way of doing this? I'm a bit afraid of repercussions such as deleted app preferences on my machine if I switch to a super simple config. Is there a good way to setup a virtual machine or some other way to test it? I don't think creating a new user on my machine would be sufficient since nix-darwin is machine-wide?
This is exactly the same place I'm at. I don't understand why this is happening, as there isn't a clear line between the two. |
I'd like to resolve this issue, but in the meantime I've fixed it with this in my zsh config: initExtra = ''
# Ensure homebrew paths are in PATH. We have to do this manually because
# using programs.zsh.dotDir causes these paths to be removed for some
# reason.
#
# ref: https://github.com/nix-community/home-manager/issues/6483
homebrewBinPath="/opt/homebrew/bin"
brewBinaryPath="$homebrewBinPath/brew"
masBinPath="/opt/homebrew/sbin"
if [ -f "$brewBinaryPath" ]; then
if [ -d "$masBinPath" ]; then
if [[ ":$PATH:" != *":$masBinPath:"* ]]; then
export PATH="$masBinPath:$PATH"
fi
fi
if [[ ":$PATH:" != *":$homebrewBinPath:"* ]]; then
export PATH="$homebrewBinPath:$PATH"
fi
fi
''; |
yes, using an ephemeral VM to test out your configuration(s) is a very safe way to go about testing configuration changes or reproducing bugs (as are in-place changes, because, after all, nix is all about reproducibility), but let's not send you down that rabbit hole for this issue. posting snippets of your configuration would work, or if you'd rather not, more detail as to how your configuration is laid out would be useful. when
visually, that means that:
would result in the following files and content:
i don't use macos (nor that being said, i feel fairly confident stating that this is not an issue within |
also, entirely unrelated and strictly out of curiosity - what led you to ping me as the maintainer for this? |
Thanks for that information. I was thinking about using a VM, but I don't have a simple way to create a MacOS VM. I forgot I could use home manager without nix-darwin and therefore could use a linux VM. I can do that if necessary, but the conflict seems to happen between nix-darwin's homebrew package and home-manager's zsh package. The relevant part of my config is here. If I remove all of the highlighted code, everything works. If I remove only the part in I completely understand why you say it isn't the zsh module, but I'm struggling to think of another cause when it is the I considered managing homebrew completely from home-manager, but it looked to me like home-manager's homebrew config was just a nix-darwin wrapper. Based on that, I decided it wouldn't help. Perhaps I should give that another look?
The issue template says: ![]() I just realized I was looking at the 24.11 release when I checked who was the most recent committer. There have been a few since you, so I shouldn't have pinged you. Sorry! |
Are you following the right branch?
Is there an existing issue for this?
Issue description
Homebrew is added to the PATH here. If I set
programs.zsh.dotDir = ".config/zsh"
, homebrew is no longer in the PATH.I've tested this with both unstable and release 24.11 for nixpkgs, nix-darwin, and home-manager.
Maintainer CC
@sudoforge
System information
The text was updated successfully, but these errors were encountered: