- Shell 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
All checks were successful
Dotfiles CI / test (push) Successful in 16s
Reviewed-on: #7 |
||
| .forgejo/workflows | ||
| examples | ||
| scripts | ||
| shell | ||
| tests | ||
| .gitignore | ||
| install.sh | ||
| LICENSE | ||
| README.md | ||
| versions.env | ||
| yawn.json | ||
dotfiles
A small, auditable bootstrap for Coder workspaces and other Linux homes. Coder's
Dotfiles step runs coder dotfiles on every workspace start: it clones this repo into
~/.config/coderv2/dotfiles the first time, runs git pull --ff-only on later starts, and then runs
install.sh. Every step is idempotent, so running it on each start is cheap and safe.
The repo itself is generic. Everything personal (hosts, repos, signing keys, secrets to check for)
lives in ~/.config/dotfiles/, which is never committed.
What install.sh does
| Step | What it touches | Safety |
|---|---|---|
| Shell | Adds one marked block to ~/.bashrc that sources shell/bashrc.sh (PATH for ~/.local/bin, ~/go/bin, ~/bin; completions; your bashrc.sh) |
Rest of ~/.bashrc is never changed |
| Git | Adds include.path for shell/gitconfig (generic defaults) and your gitconfig at the top of ~/.gitconfig |
Existing ~/.gitconfig settings keep priority |
| SSH host keys | Appends your pinned known_hosts entries to ~/.ssh/known_hosts |
A different existing key is reported, never overwritten |
| Tools | Forgejo CLI (fj), GitHub CLI (gh), OpenTofu, Node.js, Go and the Oracle CLI into ~/.local/opt/<tool>-<version>, linked from ~/.local/bin |
Versions and SHA-256 (amd64 + arm64) pinned in versions.env; a mismatch aborts. No sudo |
| Repos | Clones any missing entry in your repos.txt into $HOME |
Existing checkouts are not pulled or reset |
| Services | Starts scripts listed in DOTFILES_SERVICES that are not already running |
Workspace images usually have no cron, so this is what restarts them |
| Secrets | Lists any file in your secrets.txt that is missing |
Reports paths only; stores, fetches and prints nothing |
With no personal config at all, you get the shell setup, git defaults and the tools. The repo, service and secret steps do nothing until you configure them.
Use it
-
Fork or copy this repo (or use it as is).
-
In your Coder workspace parameters, set Dotfiles URL to its clone URL, for example
https://code.yawn.dev/john/dotfiles.git. Changing a parameter on an existing workspace restarts it, so do it when idle. This repo is public, so HTTPS needs no login. -
Optionally add personal config:
mkdir -p -m 700 ~/.config/dotfiles cp ~/.config/coderv2/dotfiles/examples/local.env ~/.config/dotfiles/ # ...and any of gitconfig, repos.txt, secrets.txt, known_hosts; then edit them ~/.config/coderv2/dotfiles/install.sh
Without Coder, clone the repo anywhere and run ./install.sh.
coder dotfiles passes StrictHostKeyChecking=no to its own clone and pull of this repo. That is Coder's
behaviour, not something this repo controls, and it is another reason to use an HTTPS URL.
Personal config (~/.config/dotfiles/)
| File | Purpose | Example |
|---|---|---|
local.env |
Settings for every step: git host, tools list, services, skip flags | examples/local.env |
gitconfig |
Credential helpers, commit signing | examples/gitconfig |
repos.txt |
Repositories to clone | examples/repos.txt |
secrets.txt |
Files to check for (never read) | examples/secrets.txt |
known_hosts |
SSH host keys to pin | examples/known_hosts |
bashrc.sh |
Personal aliases and exports, sourced last | — |
Set DOTFILES_CONFIG to use a different directory. Keep this directory private: in a new workspace,
copy it in together with your secrets, or keep it in a separate private repo.
Secrets
No secrets live in this repo, and none should. SSH keys, cloud credentials and CLI logins stay in
the workspace's persistent home volume. List them in secrets.txt so a new workspace tells you
what to copy in. CI fails if anything that looks like a key or token is committed.
Changing things
- Bump a tool: edit its version and both checksums in
versions.env, taken from the upstream checksum file listed there. Old versions stay in~/.local/optuntil you delete them. - Tests:
bash tests/test_install.shrunsinstall.shtwice against a throwawayHOME, with and without personal config. It checks the script is idempotent, keeps existing config, refuses bad checksums and conflicting host keys, and that the repo contains no secrets. CI runs this and ShellCheck; dispatch CI withtools=trueto also download and verify every pinned tool.