Leave Claude configuration unmanaged in full-work profile

This commit is contained in:
Ziad Arafat committed 2026-11-14 11:47:04 -07:00
1 parent a217c007c5
commit df7ffa82ed
4 files changed
+29 -12

No files matched your search

+2 -2
View File
@@ -61,7 +61,7 @@ Manual sign-ins that can't be automated: Edge (work account), Chrome and Firefox
### Agent environments
Claude's generated settings include a `SessionStart` hook that appends
For `full` and `headless`, Claude's generated settings include a `SessionStart` hook that appends
`eval "$(mise hook-env -s bash)"` to `CLAUDE_ENV_FILE`, so its Bash commands load
the mise environment. The hook is harmless when that variable is unset.
@@ -80,7 +80,7 @@ Codex configuration and credentials remain machine-local. See the
- Excludes Chrome and its managed PWAs, Telegram, Vesktop (including its settings), Krita, Defguard and the Portal 2 sound builder. Edge and its work PWAs remain.
- Uses only the Work activity and Ace Combat wallpapers, with light/dark switching. On login, other activities are removed. Wallpaper checkout uses sparse checkout to exclude the personal folder.
- Keeps notification sounds and volume feedback enabled with the default KDE Ocean sound theme.
- Excludes Codex; Claude remains available.
- Excludes Codex; Claude remains available with no dotfiles-managed settings, `CLAUDE.md`, or MCP configuration. `dot secrets render` leaves any existing Claude configuration untouched. Switching to this profile removes the Home Manager-managed Claude settings/instructions links; independently created configuration is retained.
Apply on a desktop with:
+7 -5
View File
@@ -450,11 +450,13 @@ secrets_render() {
. "$SECRETS_ENV"; set +a
local render='walk(if type == "string" then gsub("\\$\\{(?<v>[A-Z_]+)\\}"; "\(env[.v] // "")") else . end)'
local claude_json="$HOME/.claude.json"
[ -f "$claude_json" ] || echo '{}' >"$claude_json"
jq --slurpfile m <(jq "$render" "$DOTFILES_DIR/config/claude/mcp.json") '.mcpServers = ((.mcpServers // {}) + $m[0])' \
"$claude_json" >"$claude_json.tmp" && mv "$claude_json.tmp" "$claude_json" && chmod 600 "$claude_json"
ok "Claude MCP servers"
if [ "$(profile)" != full-work ]; then
local claude_json="$HOME/.claude.json"
[ -f "$claude_json" ] || echo '{}' >"$claude_json"
jq --slurpfile m <(jq "$render" "$DOTFILES_DIR/config/claude/mcp.json") '.mcpServers = ((.mcpServers // {}) + $m[0])' \
"$claude_json" >"$claude_json.tmp" && mv "$claude_json.tmp" "$claude_json" && chmod 600 "$claude_json"
ok "Claude MCP servers"
fi
mkdir -p "$HOME/.pi/agent"
(umask 077; jq "$render" "$DOTFILES_DIR/config/pi/mcp.json" >"$HOME/.pi/agent/mcp.json")
+3 -2
View File
@@ -8,10 +8,11 @@ in
home.packages = lib.optionals (config.dotfiles.gui && !config.dotfiles.work) [ pkgs.codex ];
home.file = {
".claude/settings.json".source = link "config/claude/settings.json";
".claude/CLAUDE.md".source = link "config/claude/CLAUDE.md";
".codex/hooks.json".source = link "config/codex/hooks.json";
".pi/agent/settings.json".source = link "config/pi/settings.json";
} // lib.optionalAttrs (!config.dotfiles.work) {
".claude/settings.json".source = link "config/claude/settings.json";
".claude/CLAUDE.md".source = link "config/claude/CLAUDE.md";
};
# MCP servers carry tokens, so they are rendered from config/*/mcp*.json templates
# plus ~/.config/dotfiles/secrets.env by `dot secrets render` (never committed).
+17 -3
View File
@@ -8,14 +8,16 @@ for profile in full full-work headless; do
activities = if c.dotfiles.gui then builtins.fromJSON c.xdg.configFile."dotfiles/activities.json".text else null;
theme = if c.dotfiles.gui then c.programs.plasma.configFile.kdeglobals.Sounds.Theme.value else null;
vesktop = builtins.hasAttr ".var/app/dev.vencord.Vesktop/config/vesktop/settings.json" c.home.file;
claudeSettings = builtins.hasAttr ".claude/settings.json" c.home.file;
claudeInstructions = builtins.hasAttr ".claude/CLAUDE.md" c.home.file;
}' | jq -e --arg p "$profile" '
if $p == "full" then
(.packages | index("codex") != null and index("defguard-client") != null and index("build-sound-theme") != null) and
(.activities.activities | keys == ["Personal", "Work"]) and .theme == "portal2" and .vesktop
(.activities.activities | keys == ["Personal", "Work"]) and .theme == "portal2" and .vesktop and .claudeSettings and .claudeInstructions
elif $p == "full-work" then
(.packages | index("codex") == null and index("defguard-client") == null and index("build-sound-theme") == null and index("notification-sounds") != null) and
(.activities.activities | keys == ["Work"]) and .activities.workOnly and .theme == "ocean" and (.vesktop | not)
else (.packages | index("codex") == null) and .activities == null end
(.activities.activities | keys == ["Work"]) and .activities.workOnly and .theme == "ocean" and (.vesktop | not) and (.claudeSettings | not) and (.claudeInstructions | not)
else (.packages | index("codex") == null) and .activities == null and .claudeSettings and .claudeInstructions end
'
done
# Exercise the same manifest selector used by apps and doctor in an isolated HOME.
@@ -27,7 +29,19 @@ cmd_profile full-work
work_apps="$(flatpak_apps)"
! rg -q '^(com.google.Chrome|org.telegram.desktop|dev.vencord.Vesktop|org.kde.krita)$' <<<"$work_apps"
rg -q '^com.microsoft.Edge$' <<<"$work_apps"
# Work rendering must neither overwrite an existing Claude configuration nor
# create one on a fresh machine; other rendered agent configuration still works.
printf 'GITHUB_ACCESS_TOKEN=fixture-not-a-real-token\n' >"$SECRETS_ENV"
printf '{"fixture":"preserve"}\n' >"$HOME/.claude.json"
secrets_render
jq -e '.fixture == "preserve" and (has("mcpServers") | not)' "$HOME/.claude.json"
[ -s "$HOME/.pi/agent/mcp.json" ]
mv "$HOME/.claude.json" "$HOME/.claude.json.saved"
secrets_render
[ ! -e "$HOME/.claude.json" ]
cmd_profile full
full_apps="$(flatpak_apps)"
rg -q '^com.google.Chrome$' <<<"$full_apps"
secrets_render
jq -e '.mcpServers | length > 0' "$HOME/.claude.json"
echo 'Profile checks passed'