Thanks to visit codestin.com
Credit goes to github.com

Skip to content

homebrew: allow setting greedy for all casks by default #1382

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

water-sucks
Copy link

Specifying the --greedy flag with brew upgrade for each cask has to be done on an opt-in basis for each cask specified in homebrew.casks, which can be rather tedious.

This adds an option called homebrew.greedyCasks that sets the default value for the homebrew.casks.*.greedy option, so that all casks can be changed to be greedy at once, without needing to set that option for each cask. Opting out of --greedy by setting it to false per-cask when using this option is possible as well.

Closes #572, #1201.

Comment on lines +505 to +506
greedy = mkOption {
type = types.nullOr types.bool;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s also --greedy-latest and --greedy-auto-updates, maybe this should be an enum?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK the options in this module are is just for Brewfile generation options, rather than being command-line parameters.

The only parameter I know that is possible to pass in regards to greediness of a cask is the boolean greedy: true option, so I would think it's better to not use an enum here and just stick to the boolean. I could be wrong about this tho.

Copy link
Contributor

@khaneliman khaneliman Mar 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like granularity options. Greedy would cover both latest and auto update, but you could choose either instead of both.

https://docs.brew.sh/Manpage

-g, --greedy
Also include outdated casks with auto_updates true or version :latest.

--greedy-latest
Also include outdated casks including those with version :latest.

--greedy-auto-updates
Also include outdated casks including those with auto_updates true.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I know these are granularity options, but I'm fairly sure that these parameters have to be supported by brew-bundle's upstream first.

https://github.com/LnL7/nix-darwin/tree/master/modules/homebrew.nix#L55-L60 I found this in the current Homebrew module documentation, and then I looked through the brew-bundle source code for the cask spec at https://github.com/Homebrew/homebrew-bundle/blob/9fffe077f1a5a722ed5bd26a87ed622e8cb64e0c/spec/bundle/cask_installer_spec.rb. I don't see any way to enable passing --greedy-latest and --greedy-auto-updates without modifying this code.

I've also tried passing these arguments by constructing a Brewfile outside of Nix with the following contents:

cask "discord", greedy_latest: true

to no avail, unfortunately. The same happens with greedy_auto_updates.

Now I could be completely mistaken about how Brewfiles set the greedy_auto_updates or greedy_latest, but I'm not really sure about the whole thing tbh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow setting greedy for all casks
3 participants