How dynamotn/dotfiles works
Main Components
• Chezmoi Manager & Configuration: At the core is chezmoi’s use, indicated by files like “.chezmoi.yaml.tmpl” and numerous “.chezmoitemplates” and “.chezmoiscripts”. This is the engine that reads the repository, applies templates, and deploys configurations to the target machines.
• Home Configurations: The “home” directory (and within it, “dot_config” and subdirectories) holds user-specific configuration templates for applications (e.g., shell, git, fish, eww, etc.), organized with template files and scripts.
• System/Root Configurations: The “root” directory contains OS-level configurations (e.g., configurations under “/etc”, “/usr”, “/opt”), including systemd, network settings, and SSH troves.
• Silos and Externals: The “silos” directory is used to isolate configurations for specific tools (such as “dytoy”, “firefox”, “hyprland”, “tmux”), which may also be managed as submodules. Additionally, there are “chezmoiexternals” files which pull in configurations from external sources.
• Scripts and Build Tools: The “scripts” folder provides a series of shell scripts (like setup.sh, build_container.sh) that bootstrap, validate prerequisites, or perform updates.
• Documentation & Tools: The “docs” folder (with its subdirectories for “tools” such as package_manager.md, mise.md, etc.) offers guidance on how these configurations and deployments are handled.
Relationships and Interactions
• The Chezmoi Manager serves as the orchestrator. It reads template files (with a .tmpl extension) from various directories and deploys them into the correct locations on the system (e.g., home directory, system directories).
• Home/Root configurations are processed via the chezmoi engine to generate the final dotfiles used by running applications.
• Scripts interact with both the repository and the underlying system to perform first-time setup and periodic updates.
• Externals like Git submodules and separate tool configurations (found in “silos” and “chezmoiexternals”) are integrated, ensuring that configurations from independent repositories form a cohesive part of the overall system.
Architectural Patterns and Design Principles
• Templating & Automation: Use of shell templates (.tmpl) shows a templating design that encourages automation and reusability across different machines.
• Separation of Concerns: The repository is organized by purpose (home, root, silos, etc.), clearly separating user configurations from system configurations.
• Extensibility via Git Submodules & Externals: The repository integrates external tools and configurations, reflecting a modular design that makes it easy to extend or update parts of the system independently.
• Script-driven Orchestration: The existence of multiple “run_once” and “run_onchange” scripts reflects an opinionated, stepwise deployment process integrated into chezmoi’s flow.