homebrew.onActivation.cleanup

This option manages what happens to packages installed by Homebrew that aren't present in the Brewfile generated by this module, during nix-darwin system activation.

When set to "none" (the default), packages not present in the generated Brewfile are left installed.

When set to "check", nix-darwin verifies during system activation that no Homebrew packages (taps, formulae, casks, etc.) are installed that aren't present in the generated Brewfile. If extra packages are found, activation fails with a list of them. Note that when this check fails during darwin-rebuild switch, the entire system activation is aborted and no other configuration changes will be applied until the issue is resolved.

When set to "uninstall", nix-darwin invokes brew bundle [install] with the --cleanup flag. This uninstalls all packages not listed in the generated Brewfile, i.e., brew uninstall is run for those packages.

When set to "zap", nix-darwin invokes brew bundle [install] with the --cleanup --zap flags. This uninstalls all packages not listed in the generated Brewfile, and if the package is a cask, removes all files associated with that cask. In other words, brew uninstall --zap is run for all those packages.

If you plan on exclusively using nix-darwin to manage packages installed by Homebrew, you probably want to set this option to "uninstall" or "zap".

Type
one of "none", "check", "uninstall", "zap"
Default
"none"
Example
"uninstall"
Declared
<nix-darwin/modules/homebrew.nix>