-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
bin/brew: better user config home handling #20250
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
base: main
Are you sure you want to change the base?
Conversation
@etcusrvar Let's talk about your use-case specifically: what are you trying to do that the existing code doesn't let you achieve? |
Specifically, I'd like to have my user |
@etcusrvar Two questions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This behaviour is similar to what tools like git
do, so it seems fine to me.
elif [[ -d "${HOME}/Library/Application Support/homebrew" ]] | ||
then | ||
HOMEBREW_USER_CONFIG_HOME="${HOME}/Library/Application Support/homebrew" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elif [[ -d "${HOME}/Library/Application Support/homebrew" ]] | |
then | |
HOMEBREW_USER_CONFIG_HOME="${HOME}/Library/Application Support/homebrew" | |
elif [[ -d "${HOME}/Library/Application Support/Homebrew" ]] | |
then | |
HOMEBREW_USER_CONFIG_HOME="${HOME}/Library/Application Support/Homebrew" |
I think directories in ~/Library
are usually capitalised.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"usually" being the operative word. I do see a handful of directories on my system that aren't. I was aiming for consistency across homebrew options. But I'm fine with having it be capitalized there and lower case in other locations if we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please hold on merging until we've discussed this a bit more.
I believe I've answered that a few times in the comments here and in the linked issue-- yes. both.
Primarily because no other tool requires it to be explicitly set because I'm using the default of Many other tools use Here's the docs on configuration files for a few tools-- chezmoi, fish, git, helix, htop, mise, tmux. Many of these and others follow the XDG spec, on both Linux and macOS. (And, yes, many don't. :( ) I'm fine with setting app specific environment variables, like |
if [[ -d "${HOME}/.homebrew" ]] | ||
then | ||
HOMEBREW_USER_CONFIG_HOME="${HOME}/.homebrew" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already handled by the else
case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. The reason I did this this way was because I didn't want a user who might have both ~/.homebrew
and one of the other 3 directories created to be surprised when their configuration suddenly changed. But I'm fine with only defining it once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, makes sense, thanks 👍🏻
Is it not set by the XDG environment on Linux? What desktop environment/Linux distribution are you using there?
I do not think the XDG specification should be followed on macOS.
Would setting Note that the behaviour and/or documentation for both As-is, I'm disinclined to add several new default directories based on one person/PR when it's already configurable. If it's insufficiently configurable: it would be preferable for me for |
I've used Debian, Arch, and others, and none of the
Agreed. (But many tools do anyway, such as those I listed earlier.) And, as is, without this PR, I use a wrapper script with
That would be great!
Agreed. This is an incomplete draft PR at this point, and is why I mentioned this earlier-- "If the idea meets with approval, I can add any appropriate tests and documentation."
Ok. The only change for me then as a user would be to explicitly define |
Yup, I think that's the best change here.
As long as we still pick up the |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Feature: improved HOMEBREW_USER_CONFIG_HOME
HOMEBREW_USER_CONFIG_HOME
can now be in a few standard locations~/.homebrew
$XDG_CONFIG_HOME/homebrew
(if the variable is set)~/.config/homebrew
~/Library/Application Support/homebrew
See issue #20251 for more details.
I've been using this on both macOS and Linux, without
XDG_CONFIG_HOME
explicitly set, and it reads my~/.config/homebrew/brew.env
whenever I run thebrew
command, which is nice.If the idea meets with approval, I can add any appropriate tests and documentation.