- Shell 59.9%
- Python 40.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| dotfiles | ||
| packages | ||
| private-registry | ||
| .chezmoi.toml.tmpl | ||
| .chezmoiroot | ||
| .gitattributes | ||
| .gitignore | ||
| AGENTS.md | ||
| install.sh | ||
| README.md | ||
| registry.yml | ||
dits-and-dots
Personal dotfiles managed with chezmoi. Includes modular bash configs under ~/.config/bash/bashrc.d/.
Install
bash <(curl -fsSL https://hex.wurzelraum.org/shukutils/dits-and-dots/raw/branch/main/install.sh) && source ~/.bashrc
This installs chezmoi (if missing) and applies the dotfiles. The installer itself
runs in a subshell (that's what bash <(...) does), so it can't reach back and
affect your current shell no matter what it does internally — && source ~/.bashrc
runs in your shell, right after, which is why it's chained onto this command
rather than being something install.sh does for you.
Editing configs
Never call chezmoi update/apply/re-add directly. Use:
dotpull— before you edit anything. Syncs the whole chezmoi source, not just bashrc.d.dotpush [message]— once you're done editing. Commits and pushes everything.bashedit— convenience wrapper:dotpull→ open all bashrc.d modules in vim →dotpush.
If dotpull/dotpush ever find that local and origin have diverged (e.g. a previous push
failed silently, or you edited on two machines), they don't merge blind or overwrite anything:
your local work gets pushed to a local-sync/<host>-<timestamp> branch on origin first, your
local branch is reset to match origin, then that temporary branch is deleted again — its job
was only to make the reset safe. Worst case a push fails and nothing moves; once it succeeds,
the commit SHA is printed so you can git cherry-pick it back if you ever need to, even though
it's no longer reachable from a branch name.
Run dits-help for a quick reference (chezmoi_cheatsheet still works as an alias).
Why "never call chezmoi directly" matters:
dotpull/dotpushcallchezmoi re-add/applyinternally, but chezmoi's owngit.autoCommit/autoPushconfig would otherwise fire inside that very call — a naive commit+push with no fetch-first check, racing ahead of the careful divergence handling below. This repo ships.chezmoi.toml.tmplwith both set tofalseso a freshchezmoi initnever enables them. If your machine was set up before this template existed, checkchezmoi cat-config | grep -A2 '\[git\]'— ifautoCommit/autoPushshowtrue, addautoCommit = falseandautoPush = falseunder[git]in~/.config/chezmoi/chezmoi.tomlby hand (re-runningchezmoi initwon't pick up the template on an already-initialized source repo).
Note:
~/.bashrcitself is never touched by chezmoi and stays yours to customize per-machine.install.shonly makes sure it has one include line pointing at~/.config/bash/bashrc, which is what chezmoi manages and which sources everything under~/.config/bash/bashrc.d/. For machine-local additions that shouldn't be synced at all, use~/.bash_aliasesinstead.
Additional repos (registry.yml)
Beyond this repo's own bashrc.d modules, registry.yml lists other git repos of
bash functions — private or public — that plug into the same loading mechanism
as local_source_dirs in ~/.shukonfig/shukonfig.yml: any repo's init.sh gets
sourced automatically once it's cloned locally.
dits-new— scaffold a brand-new registry repo before it exists anywhere: a local git repo with aninit.sh(contract + a demo function) and aREADME.md. Push it to your forge yourself when it's ready.dits-list— show every registry repo and whether it's installed on this machine.dits-register— add a new repo interactively: prompts for a name, the plain clone URL, and an access token (hidden input), builds the authenticated URL, encrypts it (its own passphrase, typed twice), and appends the entry toregistry.yml. Doesn't push — rundotpushyourself once you're happy with it.dits-install <name>— decrypt that repo's clone URL (prompts for its own passphrase) and clone it. Never re-clones if already present.dits-update—dotpull, then syncs every installed registry repo the same waydotpull/dotpushsync dits-and-dots itself: commits any local edits, pulls (fast-forward if behind), and pushes if ahead. On real divergence it snapshots to alocal-sync/<host>-<ts>branch, resets to origin, then deletes that branch again (prints the commit SHA for manual recovery) — same asdotpull. If the repo's token can't push at all (read-only), nothing is lost or left blocking the pull either: local work goes on a local-only branch (never pushed — it just doesn't exist upstream), the repo is reset to match origin, and that trade-off is printed plainly. Finishes by reloading the shell functions. No passphrase needed for any of this post-install: the decrypted URL (including any auth token) lives on in that clone's ownoriginremote, not in this repo.
"Installed" is never tracked in a file — it's just whether the repo's clone_dir
exists, checked fresh every time. Nothing about a private repo's host, path, or
token is ever in registry.yml itself; that's only ever inside its own
private-registry/<name>.age blob, encrypted with a passphrase specific to that
one repo. See private-registry/sample-private-repo.age for a working local example (demo
passphrase: dits-demo) and the separate sample-private-repo-template repo
(~/Repos/shk/sample-private-repo-template on this machine) for the init.sh
contract to build a real one from.
Machine config (shukonfig)
~/.shukonfig/shukonfig.yml holds what's specific to one machine: folder
watchers, paperless servers, BorgBase accounts and authentik servers (with
their tokens), extra shell dirs. It's never synced. To see and change it:
shukonfig edit(or justshukonfig) — full-screen editor. Left: every key, grouped (Folder watchers, Paperless, Backups, authentik, Shell), with ✓ / ! / ✗ status. Right: what the key means, its current value, problems, and for watchers whether the timer runs, how the last run went and how many files are waiting./searches,aadds an entry,dremoves,ctrl+sshows the diff and saves (keeping a.bak), then runsshk-watch syncif watchers changed. Tokens are never shown. Comments in the file survive. Folder lists are built by browsing (aadds the highlighted folder); a paperless action's instance is picked from the configured ones, and its tags, document type, correspondent, storage path and owner from that instance's own lists (asked over its API with the token).tin any picker types the value instead; there, tab completes folder names like the shell.shukonfig validate— the same checks, printed.
Needs uv (shk_install_uv). The Python lives in packages/ of this repo,
outside the chezmoi root, and runs straight from the chezmoi clone:
packages/confedit is a generic schema-driven editor (also used by nexnova's
nexnova config edit), packages/shukonfig describes this file. A new key
for this file = a field in packages/shukonfig/shukonfig/schema.py.
Tests: cd packages/shukonfig && uv run --no-project --with-editable ../confedit --with-editable . --with pytest python -m pytest tests.
Folder watchers (shk-watch)
shk-watch (deployed to ~/.local/bin) runs actions on folders on a schedule, via
generated systemd --user timers. ~/.shukonfig/shukonfig.yml is the source of
truth (chezmoi creates it once, every option commented out, and then never
touches it again — so it's per-machine and secrets in it are never synced):
watchers:
- id: downloads # names the units: shk-watch-downloads.{service,timer}
folders:
- ~/Downloads
schedule: hourly # systemd OnCalendar syntax (default: hourly)
instant: true # optional; also run as soon as a file lands
hc: https://hc-ping.com/<uuid> # optional; pinged /start, then success or /fail + run log
actions: # run in order, per folder
- delete: {older_than: 30d}
- alert: {max_files: 50, older_than: 14d} # tripping = run fails -> hc /fail
- paperless: {instance: home, tags: [3, 7], document_type: 2, owner: 1}
shukonfig edit— see, add and change watchers in one place (above).shk-watch add— questionnaire that writes a new watcher into shukonfig.yml and syncs.shk-watch list/rm <id>/run <id>— inspect, remove, or run one now.shk-watch sync— regenerate units from the config: writes one service + timer per watcher, removes units of watchers no longer configured, enables the timers, and enables linger so they run while logged out. Onlyschedule(and the folders of instant watchers) is baked into the units; actions/hc are read at run time, so editing those needs no re-sync. The service inherits thePATHof the shell that ransync. Timers arePersistent=true:dailymeans midnight, and a run missed because the machine was off happens right after the next boot.instant: trueadds ashk-watch-<id>.pathunit: systemd starts the run the moment something changes in a folder (an inbox folder that uploads to paperless as soon as you drop a scan in). The run waits until copies have finished, and repeats itself if more files arrived meanwhile. The timer keeps running as a fallback.- Durations are
<N>[m|h|d](bare number = days), measured by ctime — when a file arrived in the folder, not its (copy-preserved) mtime. paperlesscalls nexnova_py'spaperless-api upload-folder, which must be onPATH; instance credentials stay underpaperless.instancesin shukonfig.yml. This replaces both older ways of feeding paperless:paperless.upload_folderswithpaperless-api upload-folders(removed 2026-10-20) and hand-writteninotifywaitservices.- New action type: add an
_action_<type>function to the script. shk-watch migrateconverts the old per-shell-startupwatch_foldersconfig (removed 2026-09-30) into watchers.