Add options back in for setting global Homebrew variables
This commit is contained in:
parent
c61d659160
commit
2a0b9a9f60
2 changed files with 33 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -38,13 +38,6 @@ in
|
|||
configuring your Brewfile, and installing/updating the formulas therein via
|
||||
the <command>brew bundle</command> command, using <command>nix-darwin</command>.
|
||||
|
||||
When enabled, the <literal>HOMEBREW_BUNDLE_FILE</literal> and
|
||||
<literal>HOMEBREW_BUNDLE_NO_LOCK</literal> environment variables are added to
|
||||
<option>environment.variables</option>, so that when if/when you run
|
||||
<command>brew bundle</command> 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 <command>brew bundle</command>, it will
|
||||
automatically use the Brewfile in the Nix store that this module generates.
|
||||
|
||||
Sets the <literal>HOMEBREW_BUNDLE_FILE</literal> environment variable to the path of the
|
||||
Brewfile in the Nix store that this module generates, by adding it to
|
||||
<option>environment.variables</option>.
|
||||
'';
|
||||
};
|
||||
|
||||
global.noLock = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
When enabled, lockfiles aren't generated when you manually invoke
|
||||
<command>brew bundle [install]</command>. This is often desirable when
|
||||
<option>homebrew.global.brewfile</option> is enabled, since
|
||||
<command>brew bundle [install]</command> 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 <literal>HOMEBREW_BUNDLE_NO_LOCK</literal> environment variable, by adding it to
|
||||
<option>environment.variables</option>.
|
||||
'';
|
||||
};
|
||||
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue