Create custom Nix package for Claude Code CLI that fetches directly from Anthropic's Google Cloud Storage distribution instead of npm registry, working around Block's Cloudflare Teams dependency confusion protection. - Add claude-cli package with platform-specific binaries - Include comprehensive README with update instructions - Enable development role on work machine - Switch from unstable.claude-code to custom.claude-cli - Add google-cloud-sdk to work machine packages
73 lines
2.5 KiB
Nix
73 lines
2.5 KiB
Nix
{ config, lib, pkgs, globalInputs, system, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.home.roles.development;
|
|
|
|
# Fetch the claude-plugins repository
|
|
# Update the rev to get newer versions of the commands
|
|
claudePluginsRepo = builtins.fetchGit {
|
|
url = "https://github.com/jeffh/claude-plugins.git";
|
|
# To update: change this to the latest commit hash
|
|
# You can find the latest commit at: https://github.com/jeffh/claude-plugins/commits/main
|
|
rev = "5e3e4d937162185b6d78c62022cbfd1c8ad42c4c";
|
|
ref = "main";
|
|
};
|
|
in
|
|
{
|
|
options.home.roles.development = {
|
|
enable = mkEnableOption "Enable development tools and utilities";
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
home.packages = [
|
|
pkgs.unstable.claude-code-router
|
|
pkgs.unstable.codex
|
|
|
|
# Custom packages
|
|
pkgs.custom.tea-rbw
|
|
pkgs.custom.claude-cli
|
|
];
|
|
|
|
# Install Claude Code humanlayer command and agent plugins
|
|
home.activation.claudeCodeCommands = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
|
# Clean up old plugin-installed commands and agents to avoid duplicates
|
|
rm -f ~/.claude/commands/humanlayer:* 2>/dev/null || true
|
|
rm -f ~/.claude/agents/humanlayer:* 2>/dev/null || true
|
|
|
|
# Create directories if they don't exist
|
|
mkdir -p ~/.claude/commands
|
|
mkdir -p ~/.claude/agents
|
|
|
|
# Copy all humanlayer command files and remove model specifications
|
|
for file in ${claudePluginsRepo}/humanlayer/commands/*.md; do
|
|
if [ -f "$file" ]; then
|
|
filename=$(basename "$file" .md)
|
|
dest="$HOME/.claude/commands/humanlayer:''${filename}.md"
|
|
|
|
# Copy file and remove the "model:" line from frontmatter
|
|
# This allows Claude Code Pro to use the default model
|
|
${pkgs.gnused}/bin/sed '/^model:/d' "$file" > "$dest"
|
|
fi
|
|
done
|
|
|
|
# Copy all humanlayer agent files and remove model specifications
|
|
for file in ${claudePluginsRepo}/humanlayer/agents/*.md; do
|
|
if [ -f "$file" ]; then
|
|
filename=$(basename "$file" .md)
|
|
dest="$HOME/.claude/agents/humanlayer:''${filename}.md"
|
|
|
|
# Copy file and remove the "model:" line from frontmatter
|
|
# This allows Claude Code Pro to use the default model
|
|
${pkgs.gnused}/bin/sed '/^model:/d' "$file" > "$dest"
|
|
fi
|
|
done
|
|
|
|
$DRY_RUN_CMD echo "Claude Code humanlayer commands and agents installed successfully (model selection removed)"
|
|
'';
|
|
|
|
# Note: modules must be imported at top-level home config
|
|
};
|
|
}
|