Agent instructions for the scottames/dots repository.
This is a dotfiles repository managed by chezmoi.
The home/ directory (defined in .chezmoiroot) contains templates and files
that chezmoi uses to manage dotfiles in the user's home directory.
Key directories:
home/- Chezmoi source directory (maps to~)home/.chezmoiscripts/- Scripts run by chezmoi during applyhome/private_dot_config/- Config files (maps to~/.config/)aqua/- CLI tool version management via aquanix/- Nix/Darwin configuration (macOS only).dagger/- Dagger module for container-based testing.trunk/- Trunk.io linter configurations
Primary development happens inside a distrobox container on Fedora Silverblue. This affects tool availability:
- 1Password (
op): Only works viadistrobox-host-exec op(get/load commands only), requires re-auth each time - Yubikey: Accessible but touch-gated operations add friction
- Host tools: Some tools must be called via
distrobox-host-exec
Primary shell is fish. Environment setup uses a shell-agnostic approach.
Fish conf.d/ files load alphabetically. The __ prefix ensures ordering:
__is_has.fish # 1. Sets $IS_*, $HAS_* detection vars
__setenv.fish # 2. Sources ~/.setenv (main env file)
__custom_functions.fish # 3. Adds custom_functions.d/ to fish_function_path
__path.fish # 4. Builds $PATH using vars from setenv
*.fish # 5. Remaining configs (alphabetical)
| Source File | Target | Purpose |
|---|---|---|
home/dot_setenv |
~/.setenv |
Main env vars (shell-agnostic) |
home/private_dot_config/fish/conf.d/ |
~/.config/fish/conf.d/ |
Fish config snippets |
home/private_dot_config/fish/custom_functions.d/ |
~/.config/fish/custom_functions.d/ |
Fish functions |
dot_setenv works across bash/zsh/fish using fish's built-in setenv function
(csh compatibility). It sets environment variables like EDITOR, GOPATH,
AQUA_*, etc.
Detection variables (set by __is_has.fish before dot_setenv loads):
$IS_LINUX,$IS_MAC- OS detection$IS_DARK,$IS_LIGHT- Theme mode$HAS_*- Binary availability (e.g.,$HAS_NVIM,$HAS_BAT,$HAS_GHTKN)
custom_functions.d/ contains fish functions, including wrappers that extend
CLI tools (e.g., gh.fish wraps gh with token handling).
Trunk.io is the primary linter orchestrator. All linting should go through trunk:
# Check all files
trunk check
# Check specific file(s)
trunk check path/to/file
# Auto-format all files
trunk fmt
# Auto-format specific file(s)
trunk fmt path/to/fileTest chezmoi init in a container (requires dagger):
dagger call -m . initIMPORTANT: Never run chezmoi apply unless explicitly directed by the user.
This modifies the user's home directory and should only be done intentionally.
# Preview what would change (safe)
chezmoi diff
# Verify templates render correctly (safe)
chezmoi execute-template < file.tmpl- Charset: UTF-8
- Line endings: LF (Unix)
- Final newline: Always
- Indent: 2 spaces (default)
- Max file length: 200-300 lines, refactor beyond this
Exceptions defined in .editorconfig:
- Go, Makefile: tabs, 4-space width
- Python, Dockerfile: 4 spaces
Linters: shellcheck, shfmt
#!/usr/bin/env bash
set -eufo pipefail # Strict mode for .tmpl scripts
# Color definitions (common pattern)
magenta='\033[0;35m'
red='\033[0;31m'
yellow='\033[0;33m'
clear='\033[0m'
# Helper functions
info() { printf "${magenta}%s${clear}\n" "${@}"; }
err() { printf "${red}%s${clear}\n" "${@}"; exit 1; }
warn() { printf "${yellow}%s${clear}\n" "${@}"; }- Use
#!/usr/bin/env bashshebang - Quote variables:
"${var}"not$var - Use
[[ ]]for conditionals, not[ ] - Use
$(command)not backticks - Shellcheck directives in
.trunk/configs/.shellcheckrc
Linters: yamllint, prettier
- Quotes: only when needed
- No empty values in block/flow mappings
- 1 space minimum after comments
Linters: gofmt, golangci-lint
- Standard Go formatting (tabs)
- Import order: stdlib, external, internal
Linter: stylua
- 2-space indentation
- Add file mode line:
-- vi: ft=lua
Linters: black, isort, ruff, bandit
- 4-space indentation
- Black formatting
- Select rules: B, D3, E, F (see
.trunk/configs/ruff.toml)
Linter: nixpkgs-fmt
- Standard nix formatting
Linter: markdownlint
- Formatter-friendly config (formatting rules disabled)
- Let prettier handle formatting
Chezmoi uses special prefixes in home/:
dot_- Creates dotfile (e.g.,dot_bashrc->~/.bashrc)private_- Sets restrictive permissions (0600/0700)executable_- Sets executable bitsymlink_- Creates symlink*.tmpl- Go template, rendered during apply
chezmoi supports scripts that are executed when you run chezmoi apply. These scripts can be configured to run every time, only when their contents have changed, or only if they haven't been run before.
run_once_- Run once per content hashrun_onchange_- Run when watched files changerun_once_after_XX_name.sh.tmpl- Numbered for ordering
Templates use Go text/template syntax with chezmoi extensions:
{{ .chezmoi.os }} # Operating system
{{ .chezmoi.hostname }} # Machine hostname
{{ if eq .host.os "linux" }}
# Linux-specific content
{{ end }}
Use chezmoi data to view available data (pulls from home/.chezmoi.toml
written to ~/.config/chezmoi/chezmoi.toml by chezmoi)