claude-code: Add support for installing plugins (#8934)
Allow for configuring marketplaces or individual plugins. Both are provided as a list of either paths or packages. The lone plugins are enabled by adding a --plugin-dir argument to the wrapper script. Marketplaces are saved to the nix store and enabled by adding to the claude settings and known_marketplaces files. With the marketplace "installed", the plugin can just be enabled via the enabledPlugins setting.
This commit is contained in:
parent
0143d6ca9b
commit
7126ec6a55
11 changed files with 196 additions and 6 deletions
28
tests/modules/programs/claude-code/plugins.nix
Normal file
28
tests/modules/programs/claude-code/plugins.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
programs.claude-code = {
|
||||
package = config.lib.test.mkStubPackage {
|
||||
name = "claude-code";
|
||||
buildScript = ''
|
||||
mkdir -p $out/bin
|
||||
touch $out/bin/claude
|
||||
chmod 755 $out/bin/claude
|
||||
'';
|
||||
};
|
||||
enable = true;
|
||||
|
||||
plugins = [ ./test-plugin ];
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
wrapperPath="$TESTED/home-path/bin/claude"
|
||||
normalizedWrapper=$(normalizeStorePaths "$wrapperPath")
|
||||
assertFileContent $normalizedWrapper ${./expected-plugin-wrapper}
|
||||
|
||||
test "$(grep -o -- '--plugin-dir ' "$wrapperPath" | wc -l)" -eq 1
|
||||
pluginDir=$(grep -o -- '--plugin-dir /nix/store/[^ ]*' "$wrapperPath")
|
||||
pluginDir="''${pluginDir#--plugin-dir }"
|
||||
assertFileContent "$pluginDir/.claude-plugin/plugin.json" ${./test-plugin/.claude-plugin/plugin.json}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue