dotfiles: initial scaffold for Coder devboxes
install.sh (symlink home/* + merge-seed ~/.claude.json onboarding), gitconfig, bash_aliases, global gitignore, inputrc, tmux.conf. Golden owns tools+starship; this owns personal config. Secrets stay in Coder user-secrets. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
7c985c5ecf
commit
f08f35b602
7 changed files with 183 additions and 0 deletions
26
README.md
26
README.md
|
|
@ -0,0 +1,26 @@
|
|||
# dotfiles
|
||||
|
||||
Personal dotfiles for Coder devboxes (and anywhere else). Applied automatically
|
||||
on every workspace start via Coder's dotfiles feature — the template runs
|
||||
`coder dotfiles -y "$dotfiles_uri"`, which clones this repo and runs `install.sh`.
|
||||
|
||||
## What's here
|
||||
- `install.sh` — bootstrap: symlinks everything under `home/` into `$HOME`
|
||||
(backing up any real file to `*.pre-dotfiles`), then merge-seeds `~/.claude.json`
|
||||
so Claude Code skips its first-run onboarding.
|
||||
- `home/.gitconfig` — git identity + aliases + sane defaults.
|
||||
- `home/.bash_aliases` — shell shortcuts (auto-sourced by Debian's `.bashrc`).
|
||||
- `home/.config/git/ignore` — global gitignore.
|
||||
- `home/.inputrc` — readline niceties (prefix history search, smart completion).
|
||||
- `home/.tmux.conf` — tmux defaults.
|
||||
|
||||
## Division of labour
|
||||
**Golden image** owns the system: tools (claude, kubectl, docker, helm), the
|
||||
shell framework (starship, mise, eza, zoxide, fzf), VS Code settings. **This repo**
|
||||
owns only *personal* config layered on top — it never re-installs tools or fights
|
||||
golden's starship. Secrets never live here; they go in Coder **user secrets**
|
||||
(e.g. `CLAUDE_CODE_OAUTH_TOKEN`).
|
||||
|
||||
## Use
|
||||
Set the workspace's **Dotfiles repo** parameter (`dotfiles_uri`) to this repo's
|
||||
URL when creating a devbox. `install.sh` is idempotent — safe to re-run.
|
||||
36
home/.bash_aliases
Normal file
36
home/.bash_aliases
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# Personal aliases — sourced automatically by Debian's default ~/.bashrc.
|
||||
# Golden owns starship/mise/eza/zoxide/fzf setup; these just add shortcuts.
|
||||
|
||||
# listing (eza is installed in golden)
|
||||
if command -v eza >/dev/null 2>&1; then
|
||||
alias ls='eza --group-directories-first'
|
||||
alias ll='eza -la --group-directories-first --git'
|
||||
alias la='eza -a --group-directories-first'
|
||||
alias lt='eza --tree --level=2'
|
||||
fi
|
||||
|
||||
# navigation
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../..'
|
||||
alias ....='cd ../../..'
|
||||
|
||||
# git
|
||||
alias gs='git status -sb'
|
||||
alias gd='git diff'
|
||||
alias gds='git diff --staged'
|
||||
alias ga='git add'
|
||||
alias gc='git commit'
|
||||
alias gp='git push'
|
||||
alias gl='git log --oneline --graph --decorate -20'
|
||||
alias gco='git switch'
|
||||
|
||||
# tooling shortcuts (all present in golden)
|
||||
alias k='kubectl'
|
||||
alias dc='docker compose'
|
||||
alias d='docker'
|
||||
alias tf='terraform'
|
||||
|
||||
# safety
|
||||
alias rm='rm -i'
|
||||
alias cp='cp -i'
|
||||
alias mv='mv -i'
|
||||
17
home/.config/git/ignore
Normal file
17
home/.config/git/ignore
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Global gitignore (referenced by ~/.gitconfig core.excludesfile)
|
||||
# OS / editor cruft that should never land in any repo.
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
*~
|
||||
*.swp
|
||||
*.swo
|
||||
.idea/
|
||||
.vscode/
|
||||
*.log
|
||||
.env
|
||||
.env.local
|
||||
node_modules/
|
||||
__pycache__/
|
||||
*.pyc
|
||||
.venv/
|
||||
.direnv/
|
||||
33
home/.gitconfig
Normal file
33
home/.gitconfig
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
[user]
|
||||
name = lollen
|
||||
email = loloolllool@lolcathost.se
|
||||
[init]
|
||||
defaultBranch = main
|
||||
[pull]
|
||||
rebase = true
|
||||
[push]
|
||||
autoSetupRemote = true
|
||||
default = current
|
||||
[fetch]
|
||||
prune = true
|
||||
[rebase]
|
||||
autoStash = true
|
||||
[merge]
|
||||
conflictStyle = zdiff3
|
||||
[diff]
|
||||
colorMoved = default
|
||||
[color]
|
||||
ui = auto
|
||||
[core]
|
||||
excludesfile = ~/.config/git/ignore
|
||||
[alias]
|
||||
st = status -sb
|
||||
co = checkout
|
||||
sw = switch
|
||||
br = branch
|
||||
ci = commit
|
||||
ca = commit --amend
|
||||
unstage = restore --staged
|
||||
last = log -1 HEAD
|
||||
lg = log --oneline --graph --decorate -20
|
||||
lga = log --oneline --graph --decorate --all -30
|
||||
13
home/.inputrc
Normal file
13
home/.inputrc
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
$include /etc/inputrc
|
||||
|
||||
# history search on the arrow keys (type a prefix, press Up)
|
||||
"\e[A": history-search-backward
|
||||
"\e[B": history-search-forward
|
||||
|
||||
# nicer completion
|
||||
set completion-ignore-case on
|
||||
set completion-map-case on
|
||||
set show-all-if-ambiguous on
|
||||
set colored-stats on
|
||||
set colored-completion-prefix on
|
||||
set mark-symlinked-directories on
|
||||
17
home/.tmux.conf
Normal file
17
home/.tmux.conf
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Sensible tmux defaults. (Install tmux in the devbox if you use it; harmless otherwise.)
|
||||
set -g mouse on
|
||||
set -g history-limit 50000
|
||||
set -g base-index 1
|
||||
setw -g pane-base-index 1
|
||||
set -g renumber-windows on
|
||||
set -sg escape-time 10
|
||||
set -g default-terminal "tmux-256color"
|
||||
set -ga terminal-overrides ",*256col*:Tc"
|
||||
|
||||
# splits keep the current path
|
||||
bind '"' split-window -v -c "#{pane_current_path}"
|
||||
bind % split-window -h -c "#{pane_current_path}"
|
||||
bind c new-window -c "#{pane_current_path}"
|
||||
|
||||
# reload
|
||||
bind r source-file ~/.tmux.conf \; display "tmux.conf reloaded"
|
||||
41
install.sh
Executable file
41
install.sh
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env bash
|
||||
# Coder dotfiles bootstrap — runs via `coder dotfiles` on every workspace start.
|
||||
# Idempotent + merge-safe. Golden owns system tools + starship/mise/eza; this repo
|
||||
# owns personal config only. Safe to run repeatedly.
|
||||
set -euo pipefail
|
||||
DOTS="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
log(){ printf '[dotfiles] %s\n' "$*"; }
|
||||
|
||||
# 1) Symlink everything under home/ into $HOME, preserving structure. A real
|
||||
# (non-symlink) file already there is backed up once to <file>.pre-dotfiles.
|
||||
if [ -d "$DOTS/home" ]; then
|
||||
while IFS= read -r -d '' f; do
|
||||
rel="${f#"$DOTS/home/"}"
|
||||
dst="$HOME/$rel"
|
||||
mkdir -p "$(dirname "$dst")"
|
||||
if [ -e "$dst" ] && [ ! -L "$dst" ]; then mv "$dst" "$dst.pre-dotfiles"; fi
|
||||
ln -sfn "$f" "$dst"
|
||||
log "linked ~/$rel"
|
||||
done < <(find "$DOTS/home" -type f -print0)
|
||||
fi
|
||||
|
||||
# 2) Seed ~/.claude.json so Claude Code skips first-run onboarding (theme + login
|
||||
# wizard). Auth itself comes from the CLAUDE_CODE_OAUTH_TOKEN user-secret env
|
||||
# var — this only marks onboarding complete. Merge-safe: preserves whatever
|
||||
# Claude Code writes there (projects, mcp, etc.).
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
python3 - <<'PY'
|
||||
import json, os
|
||||
p = os.path.expanduser("~/.claude.json")
|
||||
try:
|
||||
d = json.load(open(p))
|
||||
except Exception:
|
||||
d = {}
|
||||
d.setdefault("theme", "dark")
|
||||
d["hasCompletedOnboarding"] = True
|
||||
json.dump(d, open(p, "w"), indent=2)
|
||||
print("[dotfiles] seeded ~/.claude.json (onboarding + theme)")
|
||||
PY
|
||||
fi
|
||||
|
||||
log "done"
|
||||
Loading…
Add table
Add a link
Reference in a new issue