Commit graph

45 commits

Author SHA1 Message Date
Malo Bourgon
24531016d8
modules/homebrew: deprecate homebrew.global.lockfiles
Homebrew Bundle removed lockfile support in Homebrew 4.4.0 (Oct 2024):
the `--no-lock` CLI flag, the `HOMEBREW_BUNDLE_NO_LOCK` env var, and
the `no_lock` parameter in `installer.rb` are all dead code. Setting
`homebrew.global.lockfiles` has had no effect on current Homebrew
versions.

- Replace the `lockfiles` option with a hidden stub (matching `noLock`)
- Replace the `noLock` hard assertion with a shared deprecation warning
  for both options
- Stop setting `HOMEBREW_BUNDLE_NO_LOCK` in `environment.variables`
- Remove the lockfiles paragraph from the `brewfile` option description
2026-02-10 09:26:54 -08:00
Malo Bourgon
65cfcebaa2
modules/homebrew: remove homebrew.whalebrews option
Whalebrew support was fully removed from Homebrew Bundle in
Homebrew 4.7.0 (Nov 2025). A `whalebrew` entry in a Brewfile now
raises `RuntimeError: Invalid Brewfile: undefined method 'whalebrew'`,
breaking the entire `brew bundle` invocation.

Use `mkRemovedOptionModule` so that existing configs get a clear
warning instead of an undefined-option error. Also removes the
auto-addition of `"whalebrew"` to `homebrew.brews` and the Brewfile
generation for Docker containers.
2026-02-10 09:26:54 -08:00
Malo Bourgon
3479b795aa
modules/homebrew: add homebrew.cargoPackages option
Add support for `cargo "pkg"` entries in the generated Brewfile. Homebrew
Bundle supports installing Rust crates via `cargo install`; the `rust`
formula is automatically installed if not already present.
2026-02-10 09:24:45 -08:00
Malo Bourgon
cbe4a600d4
modules/homebrew: add homebrew.goPackages option
Add support for `go "pkg"` entries in the generated Brewfile. Homebrew
Bundle supports installing Go packages via `go install`; the `go`
formula is automatically installed if not already present.
2026-02-10 09:24:17 -08:00
Malo Bourgon
c65c24c87c
modules/homebrew: add postinstall option for brews and casks
Both `brew bundle` formula and cask installers support a `postinstall`
option -- a shell command to run after the package is installed or
upgraded. The command only executes when the package actually changed,
not on every `brew bundle` run.

Examples from the Homebrew docs added to the `homebrew.brews` and
`homebrew.casks` option examples and tests.
2026-02-10 09:22:16 -08:00
Malo Bourgon
a3fd89f1bb
modules/homebrew: add link: :overwrite support
Homebrew supports `link: :overwrite` which runs `brew link --overwrite`,
force-overwriting existing symlinks. Extract the existing
`restart_service` special-case logic into a reusable helper
(`mkBrewfileLineBoolOrSymbolString`) for options that can be either a
bool or a Ruby symbol in the Brewfile.
2026-02-10 09:22:15 -08:00
Malo Bourgon
36815b4852
modules/homebrew: add restart_service "always" support
Homebrew supports restart_service: :always which restarts the service
on every brew bundle run, even if the formula wasn't changed.
2026-02-10 09:22:15 -08:00
Michael Hoang
7c952d9a52
Add support for installing vscode extensions via brew (#1222) 2026-02-10 15:13:34 +00:00
Frank Chiarulli Jr.
fdbfb1dc1b add support for installing vscode extensions via brew 2026-02-09 21:59:25 -05:00
Josh Gibbs
53dd29f381
remove duplicates from brewfile 2026-02-03 21:22:21 -08:00
Sam
04a3412801
homebrew: allow setting greedy for all casks by default (#1382) 2025-06-22 06:00:51 +00:00
Garrett Hopper
f67a4856c3 Update homebrew module documentation and examples
- Replace deprecated homebrew/cask-fonts with apple/apple tap example
- Update documentation links from archived homebrew-bundle to brew.sh/Brew-Bundle-and-Brewfile
- Update source file references to new location in main brew repository
2025-06-17 05:52:35 -05:00
Brian Romanko
0721726e21
Wrap the call with env 2025-06-13 16:49:58 -07:00
Brian Romanko
300af6fcc5
Preserve PATH variable when using sudo
Some systems set `secure_path` in sudoers. When this is set
the `PATH` variable is not set in the sudo environment. Using
`--preserve-env=PATH` ensures that the PATH env var is set properly
in those systems.

This is similar to the issue with [darwin-rebuild](https://github.com/nix-darwin/nix-darwin/issues/798)
not working with sudo on these systems.
2025-06-13 16:49:57 -07:00
Emily
c449918bfb homebrew: move to system activation
This adds an optional explicit `homebrew.user` option that allows users
to avoid setting `system.primaryUser`, partly as a proof of concept
of what the interfaces should look like in the future. Homebrew only
officially support one global installation, so a singleton matches
upstream’s expectations; in practice, it may be useful for us to
nest this into `users.users.*.homebrew` instead, at the expense of
being an unsupported setup if used to its full potential. Since
that would be a breaking change to the inteface anyway, I think
adding `homebrew.user` for now is acceptable. (I think one native
Apple Silicon and one Rosetta 2 Homebrew installation – under
`/opt/homebrew` and `/usr/local` respectively – may be exceptions
to this lack of upstream support, but that would be complicated to
support even with `users.users.*.homebrew`.)

I’m not entirely sure where in system activation this should
go. Probably after the user defaults and launch agents stuff, to match
the existing logic in user activation, and I lean towards doing it
as late as possible; too early and we might not have the users and
groups required to bootstrap a Homebrew installation set up, but
as Homebrew installations could be fiddly and fail, doing it in the
middle could leave a partially‐activated system.

Probably it should be done in a launch agent or something instead, but
this is my best guess as to the appropriate place for now. The downside
is that activation scripts generally won’t be able to assume that the
Homebrew prefix is populated according to the current configuration,
but they probably shouldn’t be depending on that anyway?
2025-05-16 16:29:17 +01:00
Varun Narravula
e2361f4496
homebrew: allow setting greedy for all casks by default 2025-03-11 01:23:51 -07:00
Yifei Sun
d06cf700ee
homebrew: remove --no-lock flag
https://github.com/Homebrew/homebrew-bundle/pull/1630
2025-03-04 12:09:11 -05:00
Emily
c31b6e8a03 homebrew: use mas from Nixpkgs
Currently, setting `homebrew.masApps` causes `"mas"` to automatically
be added to `homebrew.brews`. Users who want to use Homebrew only
for managing App Store apps and casks, like me, can override this
by setting `homebrew.brews = lib.mkForce [ ];` and adding Nixpkgs’
`mas` to their `environment.systemPackages`.

When the activation script path no longer depends on the built
configuration’s `environment.systemPackages`, this will no longer
work. Since this was originally added before `mas` was packaged in
Nixpkgs and we now have a perfectly serviceable binary package,
we can add it to the `$PATH` when invoking Homebrew and skip the
automatic formula installation.

As the Homebrew `bin` directory still comes first, users who
specifically want the formula can restore the previous behaviour by
explicitly adding `"mas"` to `homebrew.brews`.

Closes: #1314
2025-02-08 16:18:38 +00:00
Jalal El Mansouri
6ee6262d24 Add --ignore-dependencies option for casks
Some casks have extrenal dependencies managed by brew, neovide for
examples declares neovim as a dependency, a problem arises when you want
to use a nix managed neovim instead
2025-01-05 10:29:12 -03:00
Weijia Wang
def1e23be8 treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
Malo Bourgon
0625792671 Add homebrew.onActivation.extraFlags option 2023-09-11 11:22:23 -07:00
run
ffccbdf7d8
add progress to homebrew package installations 2023-08-17 10:00:39 +05:30
Emily
5fd8914dac treewide: fix mkEnableOption docs
`mkEnableOption` wraps its argument in a complete sentence with a
terminating full stop; an additional newline will add an incorrect
space before the end of the sentence in the rendered documentation,
and any additional verbiage that doesn't fit into the form "Whether to
enable [...]." is also incorrect. In the latter case, the description
can be overridden manually.
2023-07-21 21:17:59 +01:00
Emily
e65131e69c treewide: convert all option docs to Markdown
This process was automated by [my fork of `nix-doc-munge`]; thanks
to @pennae for writing this tool! It automatically checks that the
resulting documentation doesn't change, although my fork loosens
this a little to ignore some irrelevant whitespace and typographical
differences.

As of this commit there is no DocBook remaining in the options
documentation.

You can play along at home if you want to reproduce this commit:

    $ NIX_PATH=nixpkgs=flake:nixpkgs/c1bca7fe84c646cfd4ebf3482c0e6317a0b13f22 \
      nix shell nixpkgs#coreutils \
      -c find . -name '*.nix' \
      -exec nix run github:emilazy/nix-doc-munge/0a7190f600027bf7baf6cb7139e4d69ac2f51062 \
      {} +

[my fork of `nix-doc-munge`]: https://github.com/emilazy/nix-doc-munge
2023-06-24 10:48:55 +01:00
Emily
b97c235e37 treewide: tweak DocBook docs for conversion
These help `nix-munge-doc` automate more of the Markdown conversion
process. See the following nixpkgs commits for explanations of many
of these changes:

* 275a34e0d8
* 694d5b19d3
* f1d39b6d61
* 16102dce2f

I couldn't think of any particularly good way to format the
`system.defaults` breadcrumbs, so I just made them standalone
paragraphs. They weren't rendering correctly in DocBook anyway.
2023-06-24 10:48:55 +01:00
Malo Bourgon
2ddebb3189 Improve documentation of homebrew module 2022-09-01 10:50:23 -07:00
Malo Bourgon
7710d1d7d6 Add global into a submodule
* Add `homebrew.global.autoUpdate` option.
* Remove `homebrew.global.noLock` option, and replace it with
  `hombrew.global.lockfiles`.
2022-09-01 10:50:21 -07:00
Malo Bourgon
b547a7acb0 Create submodule for activation related homebrew options
* Adds `homebrew.onActivation` submodule.
* Moves `homebrew.autoUpdate` to `homebrew.onActivation.autoUpdate`.
* Moves `homebrew.cleanup` to `homebrew.onActivation.clean`.
* Adds new option `homebrew.onActivation.upgrade`.
2022-08-31 18:40:21 -07:00
Malo Bourgon
46032bad42 Cleanup/improve homebrew module's code, documentation, and option descriptions 2022-08-30 13:30:03 -07:00
Malo Bourgon
02a38c6a89 Enable defining options for casks using submodule 2022-08-30 12:32:16 -07:00
Malo Bourgon
56031db9c1 Enable defining options for brews using submodule 2022-08-30 12:32:16 -07:00
Malo Bourgon
bd93329d6c Enable defining options for taps using submodule 2022-08-30 12:32:16 -07:00
Malo Bourgon
92da7697d1 Add homebrew.caskArgs option 2022-08-30 12:32:14 -07:00
AlexOwl
903eb89a07
Update homebrew.nix 2022-08-19 21:07:04 +04:00
Malo Bourgon
bef3621501 Fix homebrew.brewPrefix default value on Apple Silicon 2022-01-17 16:07:09 -08:00
Steve Purcell
7f68974ea4 Set brewPrefix defaults according to platform
This allows homebrew support to work out of the box on Apple Silicon
machines.

See #322
2022-01-17 17:23:31 +01:00
Andreas Schmid
f6bec24aeb homebrew: make brew path configurable
Signed-off-by: Andreas Schmid <service@aaschmid.de>
2021-05-26 22:03:00 +02:00
Malo Bourgon
23cb959893 Fix indentation again 2021-01-16 15:15:29 -08:00
Malo Bourgon
acc906d982 Update changelog and fix indentation. 2021-01-16 12:39:01 -08:00
Malo Bourgon
2a0b9a9f60 Add options back in for setting global Homebrew variables 2020-12-30 19:01:22 -08:00
Malo Bourgon
c61d659160
Fix typo in homebrew module
Co-authored-by: Scott Day <services.github@probablyadev.com>
2020-12-28 10:45:30 -08:00
Malo Bourgon
7fd183c5d2 Remove homebrew.userConfig options and cleanup docs 2020-12-18 11:52:03 -08:00
Malo Bourgon
6b56100982 Move Homebrew installation check to activation script 2020-12-17 16:54:29 -08:00
Malo Bourgon
9961b72463 Make better use of optional(s) functions in homebrew module 2020-12-17 14:42:07 -08:00
Malo Bourgon
e1425db70d Move programs.brew-bundle to homebrew 2020-12-17 13:03:57 -08:00
Renamed from modules/programs/brew-bundle.nix (Browse further)