When onActivation.cleanup == "check", a separate `brew bundle cleanup`
command is run in the system.checks phase before the actual activation.
This `brew bundle cleanup` invocation should use the same `extraEnv`
as the main `brew bundle [install]` command, for consistency.
For example, when $XDG_CONFIG_HOME is set in `extraEnv`, it should also
be picked up by `brew bundle cleanup` in the system.checks phase.
When we create users with homedir under /var, they end up with
NFSHomeDirectory under /private/var because /var is a symlink. This
breaks consequent activations and requires that user overrides their
home dir attribute with /private/var/... to pass the activation
precheck.
`realpath` should normalize the discrepancy.
Per review feedback on #1745: rather than adding one boolean option per
HOMEBREW_NO_* env var, expose a generic onActivation.extraEnv attrset that
is prepended to brewBundleCmd alongside HOMEBREW_NO_AUTO_UPDATE=1. This
covers the same use case and the long tail of other HOMEBREW_NO_* vars
without tying the module to Homebrew's naming choices.
The global-scope booleans are dropped with no replacement — users who want
these variables set globally can write them directly into
environment.variables, so a global.extraEnv would be pure sugar.
Add options to control Homebrew environment variable hints, analytics
notices, and new formulae/casks reports during system activation and
manual brew commands.
These follow the existing autoUpdate pattern: boolean options that
default to true (preserving current behavior) and set the corresponding
HOMEBREW_NO_* environment variable when disabled.
onActivation options affect brew bundle during darwin-rebuild switch.
global options affect interactive brew commands via environment.variables.
Also make sure it merges correctly and verify with a test.
This was added in nixpkgs some time ago and is quite a nice addition as
it merges additively (in contrast to allowUnfreePredicate) thus allowing
to localize allowUnfreePackage specifications to all the locations in
your local config where unfree packages are added.