4VOAN6JG5TRYVGJFWW5I5LCN6HVFTOL7KVJ2RBP44F44EI4ATHBQC CBGXBY2CSVY6SK5KLBIHTWKDVUKXZIB5EXJKULHP75QGOMH6G2WAC 46RUDLGYFOIQKDS7WWE5U6TIMYO3XY6IIIJI55HU3RXYORIVYVXQC MOQV2NY4ETD5D727YAFZNDIGSD6OVGEEDSCS2K5G6G2TOKI5B2HQC AHAA7UNL2RRXP7KERGVCC42GB564WS5BYSSFEOXW3EKVMB2UVEOAC Q2XLHBS67AEUCGEJPDR7HCWTVIYKBDNW7XBK4WN2NK4BHUNCRAOQC YODKS7KTG7ICBTVD5N32GVALERPWMG4JPL4QIR2NTL3PTIFKHEOAC KSUIUTK56M2DPFUEK5BQ6TPJL7546ADTOI3XXAAFHEMDXPYYUFYAC };hooks = {# Unreliable right now: https://github.com/anthropics/claude-code/issues/11947# Stop = [{# hooks = [{# type = "prompt";# prompt = ''You are evaluating whether Claude should stop working. Context: $ARGUMENTS\n\nAnalyze the conversation and determine if:\n1. All user-requested tasks are complete\n2. Any errors need to be addressed\n3. Follow-up work is needed.'';# timeout = 30;# }];# }];# SubagentStop = [{# hooks = [{# type = "prompt";# prompt = ''Evaluate if this subagent should stop. Input: $ARGUMENTS\n\nCheck if:\n- The subagent completed its assigned task\n- Any errors occurred that need fixing\n- Additional context gathering is needed.'';# }];# }];Notification = [{matcher = "permission_prompt|idle_prompt|elicitation_dialog";hooks = [{type = "command";command = "${pkgs.libnotify}/bin/notify-send --expire-time=15000 'Claude' 'Waiting for user input.'";}];}];
mcpServers = {context7 = {type = "http";url = "https://mcp.context7.com/mcp";headers = {# We need this for higher limits but for now it's fine and doesn't stop us using it.CONTEXT7_API_KEY = "{file:${config.age.secrets.context7Key.path}}";};};
# Creating with home-manager below to avoid permissions issues.# hooks = {};
# No support for reading from files yet. Add these manually.# ```# claude mcp add -s user -t http web-reader https://api.z.ai/api/mcp/web_reader/mcp --header "Authorization: Bearer your_api_key"# ```
# No support for reading secrets from files yet. These are added with# `~/.claude/claude-mcps.sh` instead.# context7 = {# type = "http";# url = "https://mcp.context7.com/mcp";# headers = {# # We need this for higher limits but for now it's fine and doesn't stop us using it.# CONTEXT7_API_KEY = "{file:${config.age.secrets.context7Key.path}}";# };# };#
};# Create hooks with home-manager to avoid permissions issues.home.file.".claude/hooks/format-files" = {text = /* nu */ ''#!/usr/bin/env nulet json_input = (^cat)let file_path = ""if (which jq | is-empty) { exit 1 }let $file_path = ($json_input | from json | get tool_input.file_path)if ($file_path | is-empty) { exit 1 }let extension = ($file_path | path parse | get extension)let command = match ($extension | str trim) {"rs" if (which cargo | is-not-empty) => { ["rustfmt" $file_path] }"toml" if (which taplo | is-not-empty) => { ["taplo" "fmt" $file_path] }_ => { exit 1 }}^$command.0 ...($command | skip 1)'';executable = true;
# Helper script to add MCPs.home.file.".claude/claude-mcps.sh" = {text = ''#!/usr/bin/env bash# Run this once to add the MCP servers that need API keysclaude mcp add -s user -t http context7 https://mcp.context7.com/mcp --header "CONTEXT7_API_KEY: $(cat ${config.age.secrets.context7Key.path})"claude mcp add -s user -t http web-reader https://api.z.ai/api/mcp/web_reader/mcp --header "Authorization: Bearer $(cat ${config.age.secrets.key.path})"claude mcp add -s user -t http web-search-prime https://api.z.ai/api/mcp/web_search_prime/mcp --header "Authorization: Bearer $(cat ${config.age.secrets.key.path})"'';executable = true;};