Homebrew / homebrew-bundle

📦 Bundler for non-Ruby dependencies from Homebrew, Homebrew Cask and the Mac App Store.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Filtering installed software by a set of groups

jasonmp85 opened this issue · comments

I've seen issues here and there requesting that a single Brewfile be able to gracefully handle e.g. differences between Mac and Linux installs, but my issue is a little different…

When setting up a machine (and to continuously keep it up to date with the tools I use), I use a typical/bare-bones dotfiles approach with a Brewfile as one of the first steps, in order to get e.g. antigen, VS Code, my Mac apps, and other things installed.

I enjoy having identical shell, tooling, etc. configuration between my work an home Mac, but sometimes my work requires that I install rather large or burdensome dependencies I'd like to avoid at home. Similarly, there's no need to install e.g. Lightroom on my work computer most of the time.

Ruby Gemfiles—which I assume are the inspiration for this project—have a group feature in their DSL and have for a long time. This is very useful for keeping runtime dependencies separate from e.g. development dependencies.

Is there any similar functionality in Homebrew? If my "home/work" use-case isn't compelling, consider the case where a piece of software might come with a Brewfile for the dependencies needed to run it from source, but also suggest useful tools that people who modify the source (developers) could want to install.

I think I could probably emulate something like this using environment variables, or some sort of pre-brew bundle step to concatenate a generic file with the group ones, but all of that brings with it more complex tooling and file management; a first-class group DSL feature would be a lot more natural.

i don't mind the idea and something we've floated previously in #175 and #517 (for OS specific groups). i would use this feature however, my workaround at the moment is appending my global Brewfile with instance_eval(File.read("/Users/jacob/.Brewfile.work")) which also allows me to keep things separated.

on the flip side, this makes versions and the lockfile harder to reason with as the contents will change depending on the group selection and no longer be 1:1 with with everything mentioned in the Brewfile.

I think I could probably emulate something like this using environment variables

This was what I was going to recommend.

I will "never say never" on groups but I don't see how they'll fit in with the full ecosystem today.

I enjoy having identical shell, tooling, etc. configuration between my work an home Mac, but sometimes my work requires that I install rather large or burdensome dependencies I'd like to avoid at home. Similarly, there's no need to install e.g. Lightroom on my work computer most of the time.

Another option for this (when I had the same at work) is the e.g. HOMEBREW_BUNDLE_BREW_SKIP variables set on one machine only (https://docs.brew.sh/Manpage#bundle-subcommand).