diff --git a/CHANGELOG b/CHANGELOG
index 3caea31..18b6e6b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,4 @@
-2020-12-18
+2020-12-30
- Added `homebrew` module, to manage formulas installed by Homebrew via `brew bundle`.
2020-10-25
diff --git a/modules/homebrew.nix b/modules/homebrew.nix
index ac89cf6..5088f3c 100644
--- a/modules/homebrew.nix
+++ b/modules/homebrew.nix
@@ -38,13 +38,6 @@ in
configuring your Brewfile, and installing/updating the formulas therein via
the brew bundle command, using nix-darwin.
- When enabled, the HOMEBREW_BUNDLE_FILE and
- HOMEBREW_BUNDLE_NO_LOCK environment variables are added to
- , so that when if/when you run
- brew bundle yourself, it will reference the Brewfile generated by this
- module in the store by default, and skip generating a lockfile (which would fail, since
- lockfiles are generated in the same directory as the Brewfile).
-
Note that enabling this option does not install Homebrew. See the Homebrew website for
installation instructions: https://brew.sh
'';
@@ -87,6 +80,34 @@ in
'';
};
+ global.brewfile = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ When enabled, when you manually invoke brew bundle, it will
+ automatically use the Brewfile in the Nix store that this module generates.
+
+ Sets the HOMEBREW_BUNDLE_FILE environment variable to the path of the
+ Brewfile in the Nix store that this module generates, by adding it to
+ .
+ '';
+ };
+
+ global.noLock = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ When enabled, lockfiles aren't generated when you manually invoke
+ brew bundle [install]. This is often desirable when
+ is enabled, since
+ brew bundle [install] will try to write the lockfile in the Nix store,
+ and complain that it can't (though the command will run successfully regardless).
+
+ Sets the HOMEBREW_BUNDLE_NO_LOCK environment variable, by adding it to
+ .
+ '';
+ };
+
taps = mkOption {
type = with types; listOf str;
default = [];
@@ -175,10 +196,10 @@ in
optional (cfg.masApps != {}) "mas" ++
optional (cfg.whalebrews != []) "whalebrew";
- environment.variables = mkIf cfg.enable {
- HOMEBREW_BUNDLE_FILE = "${brewfile}";
- HOMEBREW_BUNDLE_NO_LOCK = "1";
- };
+ environment.variables = mkIf cfg.enable (
+ optionalAttrs cfg.global.brewfile { HOMEBREW_BUNDLE_FILE = "${brewfile}"; } //
+ optionalAttrs cfg.global.noLock { HOMEBREW_BUNDLE_NO_LOCK = "1"; }
+ );
system.activationScripts.homebrew.text = mkIf cfg.enable ''
# Homebrew Bundle