mirror of
https://github.com/nix-community/home-manager.git
synced 2026-10-02 19:49:18 +00:00
Claude Code lists a plugin's `agents/` and `commands/` entries with a `readdir` that accepts only regular files, so symlinked directory entries are skipped. Managed plugins were linked recursively, which materializes a real directory holding one symlink per file, and wrapped with `pkgs.symlinkJoin`, which mirrors directories and symlinks the leaf files. Both layers dropped every agent and command a plugin provides. Link each plugin as a single directory symlink, and wrap it with a `runCommand` that links only top-level entries so component directories stay symlinks to the original. Also accept an attribute set for `plugins`, making the personal-plugin directory name user-controlled and stable rather than derived from the source's base name, which yields names such as `bxa1s0m3h4sh-source` that change whenever the plugin is updated. The list form keeps working, with a warning.
33 lines
898 B
Nix
33 lines
898 B
Nix
{ config, ... }:
|
|
|
|
{
|
|
programs.claude-code = {
|
|
enable = true;
|
|
package = config.lib.test.mkStubPackage {
|
|
name = "claude-code";
|
|
buildScript = ''
|
|
mkdir -p $out/bin
|
|
touch $out/bin/claude
|
|
chmod 755 $out/bin/claude
|
|
'';
|
|
};
|
|
plugins.test-plugin = ./test-plugin;
|
|
};
|
|
|
|
test.asserts.warnings.expected = [
|
|
''
|
|
`programs.claude-code.package` has no detectable version and
|
|
uses the legacy `--plugin-dir` wrapper. Strict-parser subcommands such
|
|
as `claude rc` may reject managed MCP, LSP, or plugin arguments. Upgrade
|
|
Claude Code to version 2.1.157 or later to use persistent personal
|
|
plugins instead.
|
|
''
|
|
];
|
|
|
|
nmt.script = ''
|
|
wrapperPath="$TESTED/home-path/bin/claude"
|
|
normalizedWrapper=$(normalizeStorePaths "$wrapperPath")
|
|
assertFileContent "$normalizedWrapper" ${./expected-plugin-wrapper}
|
|
'';
|
|
}
|