From f08f35b60236b9e48775904fb5ebc159074e5ef6 Mon Sep 17 00:00:00 2001 From: lollen Date: Thu, 30 Jul 2026 21:04:57 +0200 Subject: [PATCH] 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 --- README.md | 26 ++++++++++++++++++++++++++ home/.bash_aliases | 36 ++++++++++++++++++++++++++++++++++++ home/.config/git/ignore | 17 +++++++++++++++++ home/.gitconfig | 33 +++++++++++++++++++++++++++++++++ home/.inputrc | 13 +++++++++++++ home/.tmux.conf | 17 +++++++++++++++++ install.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 183 insertions(+) create mode 100644 home/.bash_aliases create mode 100644 home/.config/git/ignore create mode 100644 home/.gitconfig create mode 100644 home/.inputrc create mode 100644 home/.tmux.conf create mode 100755 install.sh diff --git a/README.md b/README.md index e69de29..a050586 100644 --- a/README.md +++ b/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. diff --git a/home/.bash_aliases b/home/.bash_aliases new file mode 100644 index 0000000..06b277a --- /dev/null +++ b/home/.bash_aliases @@ -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' diff --git a/home/.config/git/ignore b/home/.config/git/ignore new file mode 100644 index 0000000..5baa3e1 --- /dev/null +++ b/home/.config/git/ignore @@ -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/ diff --git a/home/.gitconfig b/home/.gitconfig new file mode 100644 index 0000000..714bfbb --- /dev/null +++ b/home/.gitconfig @@ -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 diff --git a/home/.inputrc b/home/.inputrc new file mode 100644 index 0000000..4ab9206 --- /dev/null +++ b/home/.inputrc @@ -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 diff --git a/home/.tmux.conf b/home/.tmux.conf new file mode 100644 index 0000000..a26c480 --- /dev/null +++ b/home/.tmux.conf @@ -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" diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..6efefff --- /dev/null +++ b/install.sh @@ -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 .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"