modules/homebrew: add homebrew.cargoPackages option
Add support for `cargo "pkg"` entries in the generated Brewfile. Homebrew Bundle supports installing Rust crates via `cargo install`; the `rust` formula is automatically installed if not already present.
This commit is contained in:
parent
cbe4a600d4
commit
3479b795aa
2 changed files with 26 additions and 4 deletions
|
|
@ -562,16 +562,18 @@ in
|
|||
options.homebrew = {
|
||||
enable = mkEnableOption ''
|
||||
{command}`nix-darwin` to manage installing/updating/upgrading Homebrew taps, formulae,
|
||||
casks, Mac App Store apps, Go packages, and Docker containers, using Homebrew Bundle.
|
||||
casks, Mac App Store apps, Go packages, Cargo crates, 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.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.cargoPackages), [](#opt-homebrew.whalebrews), and
|
||||
[](#opt-homebrew.vscode) options to list the Homebrew formulae, casks, Mac App
|
||||
Store apps, Go packages, Cargo crates, 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
|
||||
|
|
@ -789,6 +791,18 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
cargoPackages = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
example = [ "ripgrep" ];
|
||||
description = ''
|
||||
List of Rust packages to install using {command}`cargo install`.
|
||||
|
||||
Homebrew will automatically install the {command}`rust` formula if it is not already
|
||||
installed.
|
||||
'';
|
||||
};
|
||||
|
||||
whalebrews = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
|
|
@ -867,6 +881,7 @@ in
|
|||
+ 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 "Cargo packages" (map (v: ''cargo "${v}"'') cfg.cargoPackages)
|
||||
+ 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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue