Skip to content

feat: persist selected ~/.config dirs to /shared (adds gcloud)#9

Merged
fx merged 2 commits into
mainfrom
feat/persist-config-dirs-to-shared
Jun 4, 2026
Merged

feat: persist selected ~/.config dirs to /shared (adds gcloud)#9
fx merged 2 commits into
mainfrom
feat/persist-config-dirs-to-shared

Conversation

@fx

@fx fx commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Summary

Generalizes the Coder shared-config symlinking so any ~/.config/<name> directory can be persisted to /shared/.config/<name> and survive workspace rebuilds — instead of a hardcoded per-tool block.

  • New reusable symlink_shared_config <name> helper in setup-shared-symlinks: migrates an existing real ~/.config/<name> into the shared location once (with a timestamped backup), then symlinks ~/.config/<name>/shared/.config/<name>.
  • New SHARED_CONFIG_DIRS list driving it — add a directory name to share another config folder.
  • Seeded with gcloud, so gcloud credentials (including application-default / ADC) persist across rebuilds.

Why

.config is skipped by the generic home-dir symlink loop (chezmoi-managed), so previously only gh was special-cased. Workspace rebuilds wiped ~/.config/gcloud, dropping ADC and breaking anything needing GCP creds (e.g. Vertex AI at service startup). This makes adding more shared .config folders a one-line list edit rather than a copy-pasted block.

Adding more folders

SHARED_CONFIG_DIRS=(
    gcloud
    # add more here, e.g. some-tool
)

Notes

  • gh keeps its existing dedicated block (it has a dotfiles-seeded hosts.yml bootstrap); only the generic .config folders go through the new helper.
  • Idempotent: re-running only re-points the symlink; an already-symlinked target is left as-is (no repeat backups).

Add a generic symlink_shared_config helper + a SHARED_CONFIG_DIRS list so
~/.config/<name> directories can be persisted to /shared/.config and survive
workspace rebuilds. Seeds the list with gcloud (so application-default / ADC
credentials persist). Add more directory names to SHARED_CONFIG_DIRS to share
additional config folders.
Copilot AI review requested due to automatic review settings June 4, 2026 16:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the Coder workspace shared-config setup to make persisting ~/.config/<tool> directories to /shared/.config/<tool> reusable and list-driven, so tool credentials/config survive workspace rebuilds (seeded with gcloud).

Changes:

  • Added a reusable symlink_shared_config <name> helper to migrate an existing real ~/.config/<name> into /shared/.config/<name> and then symlink it back.
  • Introduced a SHARED_CONFIG_DIRS list to drive which ~/.config/* directories get persisted (initially: gcloud).
  • Kept the existing special-case GitHub CLI (gh) seeding/symlink logic intact.

Comment thread .chezmoiscripts/run_onchange_after_setup-shared-symlinks.sh.tmpl
cp could partially fail (permissions/special files) while the script still
moved the original aside and symlinked to an incomplete /shared copy, leaving
the real config only in the backup. Use cp -a and abort the migration (leaving
the real config in place) if the copy fails.
@fx fx merged commit 6fc50a5 into main Jun 4, 2026
3 checks passed
@fx fx deleted the feat/persist-config-dirs-to-shared branch June 4, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants