Hacker News new | ask | show | jobs
by pxc 786 days ago
I use it to install a bunch of Homebrew casks and a small number of regular packages to support those casks. It works perfectly well!

My biggest annoyance is that Homebrew is really slow; the Homebrew part of my Nix-Darwin rebuilds usuay takes 3-5x as long as everything else combined. Homebrew is really slow even when it has nothing to do.

The only caveat worth mentioning is that the module built into Nix-Darwin doesn't support installing Homebrew itself. Instead you tell it the prefix for an existing Homebrew installation.

(There is an out-of-tree module for installing Homebrew as well, but I haven't tried it.)

1 comments

Make sure you are disabling auto-update and auto-upgrade for most of the homebrew slowness. I like to roll the update/upgrade into a single, intentional call rather than rely on homebrews built-in logic.
That's the default for Nix Darwin's Homebrew module, see:

https://github.com/LnL7/nix-darwin/blob/230a197063de9287128e...

and

https://github.com/LnL7/nix-darwin/blob/230a197063de9287128e...

By default, brew commands run manually do still perform the automatic updates, though. That can be disabled with the following Nix-Darwin option: https://daiderd.com/nix-darwin/manual/#opt-homebrew.global.a...

I'm not sure whats taking so long then. My entire darwin-rebuild switch takes ~1s without the homebrew commands. If I manually run homebrew separately it takes ~4s the first time and ~1.5s in subsequent runs.
So you inspired me to take a look again, and it is indeed because I'm running `brew update` on my Nix-Darwin activations. It gets invoked in this script, which I call upon the advice of the KDE Mac tap maintainers: https://invent.kde.org/packaging/homebrew-kde/-/blob/master/...

The other problem is that each brew invocation is slow, and I have to invoke it twice before I can even call that script, due to some quirks of how my Homebrew prefix is set up.

Idk, maybe I'll just... not. I'm not currently actually using any KDE apps on Mac.