What does HackerNews think of homebrew-bundle?
📦 Bundler for non-Ruby dependencies from Homebrew, Homebrew Cask and the Mac App Store.
I haven’t had time to try Nix yet, but HomeBrew does have a declarative-ish workflow that I’ve been using for years:
Brew Bundle [1] lets you have a plaintext file listing all packages you want installed on your system. Add a line for stuff you want installed, delete a line for stuff you want removed, invoke it the right way and it will install/remove packages until your system matches the list. The initial list can be generated by “brew bundle dump” or something like that.
For configuration, I find that a normal dotfile repo cloned into my ~/.config (with a script that maintains symlinks to config files in e.g. ~/Library) works well enough for my use.
I was using text files before as well to manage it.
I think the only real issue here is that you can't really pin to specific versions unless a formula exists, and there is no guarantee that a formula with a pinned version will stick around because homebrew likes to stay lean. So to that extent it can still be unclear what version of software someone is running on after enough time.
See more info in the semi official docs of the subcommand: https://github.com/Homebrew/homebrew-bundle
Personally I use homebrew-cask to manage almost all applications and their updates, turning auto-updating off in almost all apps. That way I am in control and can update when it is convenient, know if an update broke something, etc.
Edit, using:
If you're on OS X then `brew bundle dump` and `brew bundle install` will also help[1]
[0] circleci config: https://gist.githubusercontent.com/bauerd/27b24d1a3f881fe508...
https://medium.com/@satorusasozaki/automate-mac-os-x-configu...
Also, why do people copy & paste `brew install` or `brew cask install` so many times in a script when you can do something like `xargs`?
One of my complaints with Homebrew (and most system package managers) is that it treats all dependencies as equal. If I install X, which depends on Y and Z... I'd expect Y and Z to be removed when uninstalling X. If anyone else is frustrated by this, I'd suggest checking out homebrew-bundle [0]. The idea is simple: you create a Brewfile and you use that to track dependencies. Instead of installing stuff from the CLI, you add entries to your Brewfile and run "brew bundle --global". Sadly it won't do any automatic cleanups, so you have to run "brew bundle cleanup --global" to get a list of extraneous packages and remove em manually.
Another obvious benefit to using a text file is that you can annotate it with reminders. "What did I install this foobar tool for?"
I think migrating towards a shell environment which gets configured using idempotent scripts can help reduce bugs and lower the barrier of entry to people less familiar with the ecosystem, as well as make it easier to get your own system up and running. In the last few weeks I started toying around with nix [1], which seems to promise that... Although I'm still finding my way through their ecosystem.
I'd like to think I'm a fairly pragmatic user, so I'm willing to accept some hacks here and there. A few days back I put up a repo [2] to show what my macOS + fish shell setup looks like. It won't track configs to clean-up garbage or anything fancy like that, so if you make any change you might need to clean up manually. But it should make bootstrapping a new system a bit easier, and it encourages you to configure all universal variable definitions in a single place so you can add notes for why you're doing whatever it is you're doing. One of the biggest benefits of maintaining an idempotent fish config is that it has great performance. Since fish shell persists environment values in a single file and it lazy-loads function definitions, starting a new session happens almost instantly.
See my Brewfile in my dotfiles for how I use it to install my stuff: https://github.com/MikeMcQuaid/dotfiles/blob/master/Brewfile
If you want to go a step further there's also Strap which will bootstrap your macOS system with some sensible defaults and install Homebrew, your dotfiles and your Brewfile: https://github.com/mikemcquaid/strap
Finally, if you're interested how I combined these to replace Boxen at GitHub (our macOS system/project bootstrap tool using Puppet) read this: http://mikemcquaid.com/2016/06/15/replacing-boxen/
On one machine:
brew bundle dump
On another machine: brew bundle
You can also run `brew bundle --cleanup` to purge your system of apps that you no longer need (as long as you installed them with homebrew/homebrew-bundle in the first place).
For the development itself I'm either shipping my entire config (.vimrc for example) or use systems like spacemacs, sublimious or proton that only need 1 single file to re-install the entire state of the editor.
The install script itself [1] is then symlinking everyhing into place and executes stuff like pip install -r ~/.dotfiles/pip/packages.txt.
It takes a bit of effort to keep everything up to date but I'm never worried of loosing my "machine state". If I go to a new machine all I have to do is clone my dotfiles, execute install.sh and I have everything I need.
On servers I am using saltstack [2], a tool like puppet, ansible and friends, to ensure my machines are in the exact state I want them to be. I'm usually using the serverless version and push my states over SSH to them.
[0]: https://github.com/Homebrew/homebrew-bundle
[1]: https://github.com/dvcrn/dotfiles/blob/master/install.sh