claude: link ~/.claude.json straight to persistent storage #1500
@@ -40,7 +40,6 @@ in
|
|||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
custom.impermanence = lib.mkIf config.custom.impermanence.enable {
|
custom.impermanence = lib.mkIf config.custom.impermanence.enable {
|
||||||
userExtraFiles.${user} = [ ".claude.json" ];
|
|
||||||
userExtraDirs.${user} = [ ".claude" ];
|
userExtraDirs.${user} = [ ".claude" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -63,9 +62,16 @@ in
|
|||||||
"claude-code/.claude/skills/megamerge-place/SKILL.md".source = ./megamerge-place-skill/SKILL.md;
|
"claude-code/.claude/skills/megamerge-place/SKILL.md".source = ./megamerge-place-skill/SKILL.md;
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager.users.${user} = {
|
home-manager.users.${user} = { lib, ... }: {
|
||||||
home.file.".claude/CLAUDE.md".source = ./global-instructions.md;
|
home.file.".claude/CLAUDE.md".source = ./global-instructions.md;
|
||||||
|
|
||||||
|
# Claude Code saves ~/.claude.json by renaming a new file over the target
|
||||||
|
# of a symlink it follows only once, so the link must point straight at
|
||||||
|
# persistent storage.
|
||||||
|
home.activation.claude-json = lib.mkIf config.custom.impermanence.enable (lib.hm.dag.entryAfter [ "linkGeneration" ] ''
|
||||||
|
run ${pkgs.coreutils}/bin/ln -sfn ${config.custom.impermanence.base}/users/${user}/.claude.json "$HOME/.claude.json"
|
||||||
|
'');
|
||||||
|
|
||||||
# Disable zoxide cd hook inside Claude Code subshells to avoid cd breakage.
|
# Disable zoxide cd hook inside Claude Code subshells to avoid cd breakage.
|
||||||
# Claude Code sets CLAUDECODE=1 in all subprocesses it spawns (Bash tool,
|
# Claude Code sets CLAUDECODE=1 in all subprocesses it spawns (Bash tool,
|
||||||
# hooks, MCP, etc.), so we check for that and strip the cd function back out
|
# hooks, MCP, etc.), so we check for that and strip the cd function back out
|
||||||
|
|||||||
Reference in new issue
Block a user