mirror of
https://github.com/harivansh-afk/nix.git
synced 2026-04-15 14:03:51 +00:00
Generate Claude settings from Nix so managed commands use the correct home directory, add declarative keybindings for Shift+Enter newline support, and replace the broken inline docs hook with a portable script. Also stop exporting CLAUDE_CONFIG_DIR so Claude no longer splits managed config between ~/.claude and ~/.config/claude, and fix the status line script shebang for NixOS. Co-authored-by: Codex <noreply@openai.com>
60 lines
1.8 KiB
Nix
60 lines
1.8 KiB
Nix
{
|
|
config,
|
|
inputs,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
claudePackage = inputs.claudeCode.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
|
jsonFormat = pkgs.formats.json { };
|
|
claudeSettings = jsonFormat.generate "claude-settings.json" {
|
|
"$schema" = "https://json.schemastore.org/claude-code-settings.json";
|
|
env = {
|
|
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS = "1";
|
|
};
|
|
permissions = {
|
|
defaultMode = "bypassPermissions";
|
|
};
|
|
hooks = {
|
|
PreToolUse = [
|
|
{
|
|
matcher = "Read";
|
|
hooks = [
|
|
{
|
|
type = "command";
|
|
command = "${config.home.homeDirectory}/.claude/sync-docs.sh";
|
|
}
|
|
];
|
|
}
|
|
];
|
|
};
|
|
statusLine = {
|
|
type = "command";
|
|
command = "${config.home.homeDirectory}/.claude/statusline.sh";
|
|
};
|
|
voiceEnabled = true;
|
|
};
|
|
in
|
|
{
|
|
home.file.".local/bin/claude".source = "${claudePackage}/bin/claude";
|
|
|
|
# Claude Code stores shared config, commands, plugins, and skills in ~/.claude.
|
|
# Global UI settings changed through /config still live in ~/.claude.json and are
|
|
# intentionally left user-managed because Claude mutates that file directly.
|
|
home.file.".claude/CLAUDE.md".source = ../config/claude/CLAUDE.md;
|
|
home.file.".claude/commands" = {
|
|
source = ../config/claude/commands;
|
|
recursive = true;
|
|
};
|
|
home.file.".claude/settings.json".source = claudeSettings;
|
|
home.file.".claude/settings.local.json".source = ../config/claude/settings.local.json;
|
|
home.file.".claude/keybindings.json".source = ../config/claude/keybindings.json;
|
|
home.file.".claude/statusline.sh" = {
|
|
source = ../config/claude/statusline.sh;
|
|
executable = true;
|
|
};
|
|
home.file.".claude/sync-docs.sh" = {
|
|
source = ../config/claude/sync-docs.sh;
|
|
executable = true;
|
|
};
|
|
}
|