Add support for installing vscode extensions via brew (#1222)
This commit is contained in:
commit
7c952d9a52
2 changed files with 28 additions and 4 deletions
|
|
@ -544,10 +544,10 @@ in
|
||||||
[website](https://brew.sh) for installation instructions.
|
[website](https://brew.sh) for installation instructions.
|
||||||
|
|
||||||
Use the [](#opt-homebrew.brews), [](#opt-homebrew.casks),
|
Use the [](#opt-homebrew.brews), [](#opt-homebrew.casks),
|
||||||
[](#opt-homebrew.masApps), and [](#opt-homebrew.whalebrews) options
|
[](#opt-homebrew.masApps), [](#opt-homebrew.whalebrews), [](#opt-homebrew.vscode) options
|
||||||
to list the Homebrew formulae, casks, Mac App Store apps, and Docker containers you'd like to
|
to list the Homebrew formulae, casks, Mac App Store apps, Docker containers and Visual Studio
|
||||||
install. Use the [](#opt-homebrew.taps) option, to make additional formula
|
Code Extensions you'd like to install. Use the [](#opt-homebrew.taps) option, to make additional
|
||||||
repositories available to Homebrew. This module uses those options (along with the
|
formula repositories available to Homebrew. This module uses those options (along with the
|
||||||
[](#opt-homebrew.caskArgs) options) to generate a Brewfile that
|
[](#opt-homebrew.caskArgs) options) to generate a Brewfile that
|
||||||
{command}`nix-darwin` passes to the {command}`brew bundle` command during
|
{command}`nix-darwin` passes to the {command}`brew bundle` command during
|
||||||
system activation.
|
system activation.
|
||||||
|
|
@ -754,6 +754,22 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
vscode = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
default = [ ];
|
||||||
|
example = [ "golang.go" ];
|
||||||
|
description = ''
|
||||||
|
List of Visual Studio Code extensions to install using Homebrew Bundle.
|
||||||
|
|
||||||
|
A compatible editor (Visual Studio Code, VSCodium, Cursor, or VS Code Insiders)
|
||||||
|
must be available. If none is found, Homebrew will attempt to install
|
||||||
|
`visual-studio-code` automatically.
|
||||||
|
|
||||||
|
For more information on {command}`code` see:
|
||||||
|
[VSCode Extension Marketplace](https://code.visualstudio.com/docs/editor/extension-marketplace).
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
|
|
@ -801,6 +817,7 @@ in
|
||||||
+ mkBrewfileSectionString "Mac App Store apps"
|
+ mkBrewfileSectionString "Mac App Store apps"
|
||||||
(mapAttrsToList (n: id: ''mas "${n}", id: ${toString id}'') cfg.masApps)
|
(mapAttrsToList (n: id: ''mas "${n}", id: ${toString id}'') cfg.masApps)
|
||||||
+ mkBrewfileSectionString "Docker containers" (map (v: ''whalebrew "${v}"'') cfg.whalebrews)
|
+ 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);
|
+ optionalString (cfg.extraConfig != "") ("# Extra config\n" + cfg.extraConfig);
|
||||||
|
|
||||||
environment.variables = mkIf cfg.enable cfg.global.homebrewEnvironmentVariables;
|
environment.variables = mkIf cfg.enable cfg.global.homebrewEnvironmentVariables;
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,10 @@ in
|
||||||
"whalebrew/wget"
|
"whalebrew/wget"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
homebrew.vscode = [
|
||||||
|
"golang.go"
|
||||||
|
];
|
||||||
|
|
||||||
test = ''
|
test = ''
|
||||||
bf=${lib.escapeShellArg config.homebrew.brewfile}
|
bf=${lib.escapeShellArg config.homebrew.brewfile}
|
||||||
|
|
||||||
|
|
@ -99,5 +103,8 @@ in
|
||||||
|
|
||||||
echo "checking whalebrew entries in Brewfile" >&2
|
echo "checking whalebrew entries in Brewfile" >&2
|
||||||
${mkTest "whalebrew/wget" ''whalebrew "whalebrew/wget"''}
|
${mkTest "whalebrew/wget" ''whalebrew "whalebrew/wget"''}
|
||||||
|
|
||||||
|
echo "checking vscode entries in Brewfile" >&2
|
||||||
|
${mkTest "golang.go" ''vscode "golang.go"''}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue