Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
# (first start, or a fresh/reset devhome volume) or when the image carries a
# newer generation than the one the volume was activated with.

# home-manager's activate script records its profile under
# $XDG_STATE_HOME/nix/profiles only when that directory already exists; it
# otherwise falls back to /nix/var/nix/profiles/per-user/root. /nix is baked
# into the image, not a volume, so the fallback link is gone on every --rm and
# CURRENT never matched BAKED: activation re-ran on every single start, and any
# in-container `home-manager switch` was silently reverted by the next start.
# Creating the state dir first makes the profile land in the devhome volume,
# which is the path probed below.
mkdir -p /root/.local/state/nix/profiles
CURRENT=$(readlink -f /root/.local/state/nix/profiles/home-manager 2>/dev/null)
BAKED=$(readlink -f /opt/hm-activation)

Expand Down
10 changes: 9 additions & 1 deletion home-manager/modules/tools/agents.nix
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,19 @@ let
trap 'rm -f "$tmp" "$md.new"' EXIT

# Strip the previous managed block, plus any bare import line an
# append-era generation left behind. Everything else is hand-edited.
# append-era generation left behind, plus the container doc that the
# Dockerfile and entrypoint used to copy into this file before #122 moved
# it to ~/.claude/rules/container-env.md. A claude-home volume keeps that
# old body forever otherwise, and it then loads twice per session with one
# copy stale. The legacy doc has only ## subsections, so skip from its H1
# to the next H1 or EOF. Everything else is hand-edited.
${pkgs.gawk}/bin/awk '
/^<!-- BEGIN managed: agents overlay/ { inblock = 1; next }
/^<!-- END managed: agents overlay/ { inblock = 0; next }
inblock { next }
/^# Machine: .* via Docker container$/ { legacy = 1; next }
legacy && /^# / { legacy = 0 }
legacy { next }
$0 == "@includes/agents-entrypoint.md" { next }
$0 == "@includes/agents-company-values.md" { next }
$0 == "@includes/agents-preferred-tooling.md" { next }
Expand Down
Loading