Add beads Claude plugin installation via home-manager
- Add beadsRepo reference from flake input - Add activation script to install beads as marketplace plugin - Updates known_marketplaces.json and config.json declaratively
This commit is contained in:
55
flake.lock
generated
55
flake.lock
generated
@@ -1,5 +1,26 @@
|
||||
{
|
||||
"nodes": {
|
||||
"beads": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs-unstable"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1767911810,
|
||||
"narHash": "sha256-0L4ATr01UsmBC0rSW62VIMVVSUihAQu2+ZOoHk9BQnA=",
|
||||
"owner": "steveyegge",
|
||||
"repo": "beads",
|
||||
"rev": "28ff9fe9919a9665a0f00f5b3fcd084b43fb6cc3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "steveyegge",
|
||||
"repo": "beads",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
@@ -16,6 +37,24 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"google-cookie-retrieval": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@@ -258,6 +297,7 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"beads": "beads",
|
||||
"google-cookie-retrieval": "google-cookie-retrieval",
|
||||
"home-manager": "home-manager",
|
||||
"home-manager-unstable": "home-manager-unstable",
|
||||
@@ -269,6 +309,21 @@
|
||||
"plasma-manager": "plasma-manager",
|
||||
"plasma-manager-unstable": "plasma-manager-unstable"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
||||
@@ -42,6 +42,11 @@
|
||||
url = "github:Jovian-Experiments/Jovian-NixOS";
|
||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
};
|
||||
|
||||
beads = {
|
||||
url = "github:steveyegge/beads";
|
||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, nixos-wsl, ... } @ inputs: let
|
||||
|
||||
@@ -5,7 +5,7 @@ with lib;
|
||||
let
|
||||
cfg = config.home.roles.development;
|
||||
|
||||
# Fetch the claude-plugins repository
|
||||
# Fetch the claude-plugins repository (for humanlayer commands/agents)
|
||||
# Update the rev to get newer versions of the commands
|
||||
claudePluginsRepo = builtins.fetchGit {
|
||||
url = "https://github.com/jeffh/claude-plugins.git";
|
||||
@@ -14,6 +14,9 @@ let
|
||||
rev = "5e3e4d937162185b6d78c62022cbfd1c8ad42c4c";
|
||||
ref = "main";
|
||||
};
|
||||
|
||||
# Beads repository is available via globalInputs.beads from the flake
|
||||
beadsRepo = globalInputs.beads;
|
||||
in
|
||||
{
|
||||
options.home.roles.development = {
|
||||
@@ -36,6 +39,7 @@ in
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [
|
||||
globalInputs.beads.packages.${system}.default
|
||||
pkgs.unstable.claude-code
|
||||
pkgs.unstable.claude-code-router
|
||||
pkgs.unstable.codex
|
||||
@@ -89,6 +93,51 @@ in
|
||||
}"
|
||||
'';
|
||||
|
||||
# Install beads Claude plugin as a marketplace
|
||||
home.activation.claudeCodeBeadsPlugin = lib.hm.dag.entryAfter ["writeBoundary" "claudeCodeCommands"] ''
|
||||
# Create plugin directories
|
||||
mkdir -p ~/.claude/plugins/marketplaces
|
||||
mkdir -p ~/.claude/plugins/repos
|
||||
|
||||
# Remove old beads marketplace if it exists (to ensure clean update)
|
||||
rm -rf ~/.claude/plugins/marketplaces/beads-marketplace
|
||||
|
||||
# Copy beads repository to marketplaces directory
|
||||
# Using cp -r because the source is a Nix store path (read-only)
|
||||
cp -r ${beadsRepo} ~/.claude/plugins/marketplaces/beads-marketplace
|
||||
chmod -R u+w ~/.claude/plugins/marketplaces/beads-marketplace
|
||||
|
||||
# Update known_marketplaces.json to include beads-marketplace
|
||||
KNOWN_MARKETPLACES="$HOME/.claude/plugins/known_marketplaces.json"
|
||||
if [ ! -f "$KNOWN_MARKETPLACES" ]; then
|
||||
echo '{}' > "$KNOWN_MARKETPLACES"
|
||||
fi
|
||||
|
||||
# Add beads-marketplace entry using jq (merge with existing)
|
||||
${pkgs.jq}/bin/jq --arg installPath "$HOME/.claude/plugins/marketplaces/beads-marketplace" \
|
||||
'. + {"beads-marketplace": {
|
||||
"source": {"source": "github", "repo": "steveyegge/beads"},
|
||||
"installLocation": $installPath,
|
||||
"lastUpdated": (now | strftime("%Y-%m-%dT%H:%M:%S.000Z"))
|
||||
}}' "$KNOWN_MARKETPLACES" > "$KNOWN_MARKETPLACES.tmp" && mv "$KNOWN_MARKETPLACES.tmp" "$KNOWN_MARKETPLACES"
|
||||
|
||||
# Update config.json to install the beads plugin
|
||||
CONFIG_JSON="$HOME/.claude/plugins/config.json"
|
||||
if [ ! -f "$CONFIG_JSON" ]; then
|
||||
echo '{"repositories": {}}' > "$CONFIG_JSON"
|
||||
fi
|
||||
|
||||
# Add beads to installed repositories
|
||||
${pkgs.jq}/bin/jq --arg installPath "$HOME/.claude/plugins/marketplaces/beads-marketplace" \
|
||||
'.repositories["beads-marketplace/beads"] = {
|
||||
"source": {"source": "marketplace", "marketplace": "beads-marketplace", "plugin": "beads"},
|
||||
"installLocation": $installPath,
|
||||
"installedAt": (now | strftime("%Y-%m-%dT%H:%M:%S.000Z"))
|
||||
}' "$CONFIG_JSON" > "$CONFIG_JSON.tmp" && mv "$CONFIG_JSON.tmp" "$CONFIG_JSON"
|
||||
|
||||
$DRY_RUN_CMD echo "Claude Code beads plugin installed successfully"
|
||||
'';
|
||||
|
||||
# Note: modules must be imported at top-level home config
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user