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.
This commit is contained in:
parent
c65c24c87c
commit
cbe4a600d4
2 changed files with 27 additions and 5 deletions
|
|
@ -562,16 +562,18 @@ in
|
|||
options.homebrew = {
|
||||
enable = mkEnableOption ''
|
||||
{command}`nix-darwin` to manage installing/updating/upgrading Homebrew taps, formulae,
|
||||
and casks, as well as Mac App Store apps and Docker containers, using Homebrew Bundle.
|
||||
casks, Mac App Store apps, Go packages, and Docker containers, using Homebrew Bundle.
|
||||
|
||||
Note that enabling this option does not install Homebrew, see the Homebrew
|
||||
[website](https://brew.sh) for installation instructions.
|
||||
|
||||
Use the [](#opt-homebrew.brews), [](#opt-homebrew.casks),
|
||||
[](#opt-homebrew.masApps), [](#opt-homebrew.whalebrews), [](#opt-homebrew.vscode) options
|
||||
to list the Homebrew formulae, casks, Mac App Store apps, Docker containers and Visual Studio
|
||||
Code Extensions you'd like to install. Use the [](#opt-homebrew.taps) option, to make additional
|
||||
formula repositories available to Homebrew. This module uses those options (along with the
|
||||
[](#opt-homebrew.masApps), [](#opt-homebrew.goPackages),
|
||||
[](#opt-homebrew.whalebrews), and [](#opt-homebrew.vscode) options to list the
|
||||
Homebrew formulae, casks, Mac App Store apps, Go packages, Docker containers,
|
||||
and Visual Studio Code extensions you'd like to install. Use the
|
||||
[](#opt-homebrew.taps) option, to make additional formula repositories available to
|
||||
Homebrew. This module uses those options (along with the
|
||||
[](#opt-homebrew.caskArgs) options) to generate a Brewfile that
|
||||
{command}`nix-darwin` passes to the {command}`brew bundle` command during
|
||||
system activation.
|
||||
|
|
@ -775,6 +777,18 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
goPackages = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
example = [ "github.com/charmbracelet/crush" ];
|
||||
description = ''
|
||||
List of Go packages to install using {command}`go install`.
|
||||
|
||||
Homebrew will automatically install the {command}`go` formula if it is not already
|
||||
installed.
|
||||
'';
|
||||
};
|
||||
|
||||
whalebrews = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
|
|
@ -852,6 +866,7 @@ in
|
|||
+ mkBrewfileSectionString "Casks" cfg.casks
|
||||
+ mkBrewfileSectionString "Mac App Store apps"
|
||||
(mapAttrsToList (n: id: ''mas "${n}", id: ${toString id}'') cfg.masApps)
|
||||
+ mkBrewfileSectionString "Go packages" (map (v: ''go "${v}"'') cfg.goPackages)
|
||||
+ mkBrewfileSectionString "Docker containers" (map (v: ''whalebrew "${v}"'') cfg.whalebrews)
|
||||
+ mkBrewfileSectionString "Visual Studio Code extensions" (map (v: ''vscode "${v}"'') cfg.vscode)
|
||||
+ optionalString (cfg.extraConfig != "") ("# Extra config\n" + cfg.extraConfig);
|
||||
|
|
|
|||
|
|
@ -77,6 +77,10 @@ in
|
|||
Xcode = 497799835;
|
||||
};
|
||||
|
||||
homebrew.goPackages = [
|
||||
"github.com/charmbracelet/crush"
|
||||
];
|
||||
|
||||
homebrew.whalebrews = [
|
||||
"whalebrew/wget"
|
||||
];
|
||||
|
|
@ -112,6 +116,9 @@ in
|
|||
${mkTest "1Password for Safari" ''mas "1Password for Safari", id: 1569813296''}
|
||||
${mkTest "Xcode" ''mas "Xcode", id: 497799835''}
|
||||
|
||||
echo "checking go entries in Brewfile" >&2
|
||||
${mkTest "github.com/charmbracelet/crush" ''go "github.com/charmbracelet/crush"''}
|
||||
|
||||
echo "checking whalebrew entries in Brewfile" >&2
|
||||
${mkTest "whalebrew/wget" ''whalebrew "whalebrew/wget"''}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue