2.home-manager/tests/modules/programs/claude-code/marketplaces.nix
Pat L. 7126ec6a55
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.
2026-03-26 22:59:48 -05:00

29 lines
885 B
Nix

{ 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;
marketplaces = {
test-market = ./test-marketplace;
test-duplicate = ./test-marketplace;
};
};
nmt.script = ''
assertFileExists home-files/.claude/plugins/known_marketplaces.json
assertLinkExists home-files/.claude/plugins/known_marketplaces.json
normalizedFile=$(normalizeStorePaths home-files/.claude/plugins/known_marketplaces.json)
assertFileContent "$normalizedFile" ${./expected-known-marketplaces.json}
normalizedFile=$(normalizeStorePaths home-files/.claude/settings.json)
assertFileContent "$normalizedFile" ${./expected-settings-marketplaces.json}
'';
}