mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-13 20:30:02 +00:00
Remove homebrew.userConfig options and cleanup docs
This commit is contained in:
parent
6b56100982
commit
7fd183c5d2
1 changed files with 21 additions and 40 deletions
|
@ -1,5 +1,4 @@
|
|||
# Created by: https://github.com/malob
|
||||
# Inspired by: https://github.com/lccambiaghi/nixpkgs/blob/main/modules/homebrew.nix
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
@ -39,6 +38,13 @@ 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
|
||||
'';
|
||||
|
@ -65,14 +71,14 @@ in
|
|||
Brewfile are left installed.
|
||||
|
||||
When set to <literal>"uninstall"</literal>, <command>nix-darwin</command> invokes
|
||||
<command>brew bundle install</command> with the <command>--cleanup</command> flag. This
|
||||
<command>brew bundle [install]</command> with the <command>--cleanup</command> flag. This
|
||||
uninstalls all formulas not listed in generate Brewfile, i.e.,
|
||||
<command>brew uninstall</command> is run for those formulas.
|
||||
|
||||
When set to <literal>"zap"</literal>, <command>nix-darwin</command> invokes
|
||||
<command>brew bundle install</command> with the <command>--cleanup --zap</command>
|
||||
flags. This uninstalls all forumalas not listed in the generated Brewfile, and if the
|
||||
formula is a cask, removes all files associated with the cask. In other words,
|
||||
<command>brew bundle [install]</command> with the <command>--cleanup --zap</command>
|
||||
flags. This uninstalls all formulas not listed in the generated Brewfile, and if the
|
||||
formula is a cask, removes all files associated with that cask. In other words,
|
||||
<command>brew uninstall --zap</command> is run for all those formulas.
|
||||
|
||||
If you plan on exclusively using <command>nix-darwin</command> to manage formulas installed
|
||||
|
@ -81,54 +87,29 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
userConfig.brewfile = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
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> enviroment variable to the path of the
|
||||
Brewfile in the Nix store that this module generates, by adding it to
|
||||
<option>environment.variables</option>.
|
||||
'';
|
||||
};
|
||||
|
||||
userConfig.noLock = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
When enabled, lock files aren't generated when you manually invoke
|
||||
<command>brew bundle</command>.
|
||||
|
||||
Sets the <literal>HOMEBREW_BUNDLE_NO_LOCK</literal> enviroment variable, by adding it to
|
||||
<option>environment.variables</option>.
|
||||
'';
|
||||
};
|
||||
|
||||
taps = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [];
|
||||
example = [ "homebrew/cask-fonts" ];
|
||||
description = "Homebrew formula repositories to tap";
|
||||
description = "Homebrew formula repositories to tap.";
|
||||
};
|
||||
|
||||
brews = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [];
|
||||
example = [ "mas" ];
|
||||
description = "Homebrew brews to install";
|
||||
description = "Homebrew brews to install.";
|
||||
};
|
||||
|
||||
casks = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [];
|
||||
example = [ "hammerspoon" "virtualbox" ];
|
||||
description = "Homebrew casks to install";
|
||||
description = "Homebrew casks to install.";
|
||||
};
|
||||
|
||||
masApps = mkOption {
|
||||
type = with types; attrsOf int;
|
||||
type = with types; attrsOf ints.positive;
|
||||
default = {};
|
||||
example = {
|
||||
"1Password" = 1107421413;
|
||||
|
@ -146,7 +127,7 @@ in
|
|||
<option>homebrew.cleanup</option> is set to <literal>"uninstall"</literal>
|
||||
or <literal>"zap"</literal> (this is currently a limitation of Homebrew Bundle).
|
||||
|
||||
For more information on <command>mas</command> see: https://github.com/mas-cli/mas
|
||||
For more information on <command>mas</command> see: https://github.com/mas-cli/mas.
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -161,7 +142,7 @@ in
|
|||
<option>homebrew.brews</option>.
|
||||
|
||||
For more information on <command>whalebrew</command> see:
|
||||
https://github.com/whalebrew/whalebrew
|
||||
https://github.com/whalebrew/whalebrew.
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -194,10 +175,10 @@ in
|
|||
optional (cfg.masApps != {}) "mas" ++
|
||||
optional (cfg.whalebrews != []) "whalebrew";
|
||||
|
||||
environment.variables = mkIf cfg.enable (
|
||||
optionalAttrs cfg.userConfig.brewfile { HOMEBREW_BUNDLE_FILE = "${brewfile}"; } //
|
||||
optionalAttrs cfg.userConfig.noLock { HOMEBREW_BUNDLE_NO_LOCK = "1"; }
|
||||
);
|
||||
environment.variables = mkIf cfg.enable {
|
||||
HOMEBREW_BUNDLE_FILE = "${brewfile}";
|
||||
HOMEBREW_BUNDLE_NO_LOCK = "1";
|
||||
};
|
||||
|
||||
system.activationScripts.homebrew.text = mkIf cfg.enable ''
|
||||
# Homebrew Bundle
|
||||
|
|
Loading…
Add table
Reference in a new issue