No description
  • Shell 59.9%
  • Python 40.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
mercen.ai c8ce2d593b shk_drive_image: print exact resume command (name survives device-letter change)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:11:31 -05:00
dotfiles shk_drive_image: print exact resume command (name survives device-letter change) 2026-11-22 16:11:31 -05:00
packages shukonfig: authentik.instances (url, token, verify) 2026-11-07 14:49:09 -05:00
private-registry chezmoi sync: 2026-09-17 16:30:21 2026-09-18 05:57:15 +00:00
.chezmoi.toml.tmpl Fix install.sh remote clobbering and chezmoi autopush racing dotpush 2026-09-18 05:47:04 +00:00
.chezmoiroot first chezmoi commit 2025-12-29 11:51:30 +01:00
.gitattributes Add .gitattributes forcing LF line endings on checkout 2026-09-16 07:40:26 +00:00
.gitignore Add shukonfig edit: full-screen editor for shukonfig.yml 2026-10-20 07:59:40 -04:00
AGENTS.md Add AGENTS.md articulating the fully-automated transport requirement 2026-09-18 06:03:54 +00:00
install.sh install.sh: fix existing-source detection for .chezmoiroot layouts (chezmoi source-path != git top-level) 2026-10-07 07:41:51 +02:00
README.md shukonfig: authentik.instances (url, token, verify) 2026-11-07 14:49:09 -05:00
registry.yml Store registry clone_dir as ~/..., fix aperture-dots entry 2026-10-01 13:42:28 +00:00

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/dotpush call chezmoi re-add/apply internally, but chezmoi's own git.autoCommit/autoPush config 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.tmpl with both set to false so a fresh chezmoi init never enables them. If your machine was set up before this template existed, check chezmoi cat-config | grep -A2 '\[git\]' — if autoCommit/ autoPush show true, add autoCommit = false and autoPush = false under [git] in ~/.config/chezmoi/chezmoi.toml by hand (re-running chezmoi init won't pick up the template on an already-initialized source repo).

Note: ~/.bashrc itself is never touched by chezmoi and stays yours to customize per-machine. install.sh only 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_aliases instead.

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 an init.sh (contract + a demo function) and a README.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 to registry.yml. Doesn't push — run dotpush yourself 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 way dotpull/dotpush sync dits-and-dots itself: commits any local edits, pulls (fast-forward if behind), and pushes if ahead. On real divergence it snapshots to a local-sync/<host>-<ts> branch, resets to origin, then deletes that branch again (prints the commit SHA for manual recovery) — same as dotpull. 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 own origin remote, 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 just shukonfig) — 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, a adds an entry, d removes, ctrl+s shows the diff and saves (keeping a .bak), then runs shk-watch sync if watchers changed. Tokens are never shown. Comments in the file survive. Folder lists are built by browsing (a adds 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). t in 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. Only schedule (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 the PATH of the shell that ran sync. Timers are Persistent=true: daily means midnight, and a run missed because the machine was off happens right after the next boot.
  • instant: true adds a shk-watch-<id>.path unit: 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.
  • paperless calls nexnova_py's paperless-api upload-folder, which must be on PATH; instance credentials stay under paperless.instances in shukonfig.yml. This replaces both older ways of feeding paperless: paperless.upload_folders with paperless-api upload-folders (removed 2026-10-20) and hand-written inotifywait services.
  • New action type: add an _action_<type> function to the script.
  • shk-watch migrate converts the old per-shell-startup watch_folders config (removed 2026-09-30) into watchers.