mirror of
https://github.com/Xevion/dotfiles.git
synced 2026-01-31 06:24:13 -06:00
- Move fonts.toml from deployed location to meta/ directory - Update install-fonts.ts to read from meta/ and support extras array - Add comprehensive documentation explaining meta-configs pattern - Add ZedMono NF font and update Zed editor keybindings/settings
3.2 KiB
3.2 KiB
Meta-Configs Pattern
This repository uses a meta-config pattern for configuration files that drive imperative actions during chezmoi apply, rather than being deployed directly to the filesystem.
What are Meta-Configs?
Meta-configs are configuration files that:
- Are NOT deployed to the target system
- Drive scripts that perform imperative actions (downloads, installations, modifications)
- Live in
meta/at the repository root (outsidehome/) - Trigger
run_onchange_*scripts when their content changes
This pattern separates "what to configure" from "configuration files that get deployed."
Directory Structure
chezmoi/
├── meta/ # Meta-configs (NOT deployed)
│ ├── fonts.toml # Drives font installation
│ └── ... # Future meta-configs
├── home/ # Deployed to $HOME
│ ├── .config/
│ ├── .local/
│ └── ...
└── docs/
└── meta-configs.md # This file
Current Meta-Configs
meta/fonts.toml
Drives the install-fonts.ts script to download and install fonts.
[ui]
primary = "Inter"
fallback = "Noto Sans"
[mono]
primary = "Geist Mono"
fallback = "JetBrains Mono"
[extras]
# Fonts to install without category assignment
fonts = ["ZedMono NF"]
Triggered by: run_onchange_after_install-fonts.sh.tmpl
Script: ~/.local/bin/install-fonts.ts
How It Works
- Edit a meta-config in
meta/(e.g.,meta/fonts.toml) - Run
chezmoi apply - Chezmoi detects the file changed via
{{ include "../meta/fonts.toml" | sha256sum }} - The corresponding
run_onchange_*script executes - The script reads the meta-config and performs imperative actions
Why This Pattern?
Problem
Some configuration requires imperative actions:
- Downloading files from the internet
- Installing packages
- Modifying system state
These don't fit the declarative "deploy this file" model of chezmoi.
Solution
Meta-configs provide:
- Centralized configuration - Easy to edit, version-controlled
- Imperative execution - Scripts perform the actual work
- Change detection -
run_onchange_*only runs when config changes - Clear separation - Meta-configs are clearly not "files to deploy"
Adding a New Meta-Config
- Create
meta/<name>.tomlwith your configuration schema - Create a script in
home/dot_local/bin/to process the config - Create
home/run_onchange_after_<name>.sh.tmplthat:- Includes a hash comment:
# hash: {{ include "../meta/<name>.toml" | sha256sum }} - Calls your processing script
- Includes a hash comment:
- Document the meta-config in this file
Comparison with .managed/
| Aspect | meta/ |
.managed/ |
|---|---|---|
| Deployed | No | Yes (via symlinks) |
| Purpose | Drive imperative scripts | Source of truth for app configs |
| Consumed by | Chezmoi scripts | Applications (via symlinks) |
| Location | Repo root | Inside home/ |