summaryrefslogtreecommitdiff
path: root/modules/homebrew.nix
diff options
context:
space:
mode:
authorMalo Bourgon <mbourgon@gmail.com>2023-09-11 10:58:08 -0700
committerMalo Bourgon <mbourgon@gmail.com>2023-09-11 11:22:23 -0700
commit0625792671837155708eed2af4cad43dc9c9d825 (patch)
treee29076bbc664811cbda59c916c4bc393204d8152 /modules/homebrew.nix
parent511177ffe8226c78c9cf6a92a7b5f2df3684956b (diff)
Add `homebrew.onActivation.extraFlags` option
Diffstat (limited to 'modules/homebrew.nix')
-rw-r--r--modules/homebrew.nix20
1 files changed, 19 insertions, 1 deletions
diff --git a/modules/homebrew.nix b/modules/homebrew.nix
index 8665565..fa6f1cd 100644
--- a/modules/homebrew.nix
+++ b/modules/homebrew.nix
@@ -102,6 +102,10 @@ let
Although auto-updating is disabled by default during system activation, note that Homebrew
will auto-update when you manually invoke certain Homebrew commands. To modify this
behavior see [](#opt-homebrew.global.autoUpdate).
+
+ Implementation note: when disabled, this option sets the `HOMEBREW_NO_AUTO_UPDATE`
+ environment variable when {command}`nix-darwin` invokes {command}`brew bundle [install]`
+ during system activation.
'';
};
upgrade = mkOption {
@@ -111,6 +115,19 @@ let
Whether to enable Homebrew to upgrade outdated formulae and Mac App Store apps during
{command}`nix-darwin` system activation. The default is `false`
so that repeated invocations of {command}`darwin-rebuild switch` are idempotent.
+
+ Implementation note: when disabled, {command}`nix-darwin` invokes
+ {command}`brew bundle [install]` with the {command}`--no-upgrade` flag during system
+ activation.
+ '';
+ };
+ extraFlags = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ example = [ "--verbose" ];
+ description = lib.mdDoc ''
+ Extra flags to pass to {command}`brew bundle [install]` during {command}`nix-darwin`
+ system activation.
'';
};
@@ -120,10 +137,11 @@ let
config = {
brewBundleCmd = concatStringsSep " " (
optional (!config.autoUpdate) "HOMEBREW_NO_AUTO_UPDATE=1"
- ++ [ "brew bundle --verbose --file='${brewfileFile}' --no-lock" ]
+ ++ [ "brew bundle --file='${brewfileFile}' --no-lock" ]
++ optional (!config.upgrade) "--no-upgrade"
++ optional (config.cleanup == "uninstall") "--cleanup"
++ optional (config.cleanup == "zap") "--cleanup --zap"
+ ++ config.extraFlags
);
};
};