Thank you for your interest in maintaining and improving these dotfiles! This guide will help you understand how to make changes, test them, and keep the repository in good shape.
This dotfiles repository is managed by chezmoi, a tool that helps manage configuration files across multiple machines. The repository is designed to work on macOS, Debian/Ubuntu, and WSL.
Before making changes, ensure you have:
- Git installed
- chezmoi installed (
brew install chezmoion macOS, or see installation guide) - Familiarity with Zsh and shell scripting
- (Optional) VMware Fusion or UTM for testing on virtual machines
.
├── home/ # Files managed by chezmoi
│ ├── dot_zshrc # Zsh configuration
│ ├── dot_config/ # XDG config directory
│ └── ...
├── run_once_install-packages.sh.tmpl # Package installation script
├── install.sh # Remote installation script
├── specs/ # Feature specifications and plans
├── docs/ # Additional documentation
└── README.md # Main documentation
When working on dotfiles locally:
# Edit files in the chezmoi source directory
chezmoi edit ~/.zshrc
# See what changes would be applied
chezmoi diff
# Apply changes to your home directory
chezmoi apply -v
# Test the changes in your current shell
source ~/.zshrcTo add a new dotfile to the repository:
# Add a file to chezmoi
chezmoi add ~/.gitconfig
# Or edit it directly in the source directory
chezmoi edit ~/.gitconfigThe run_once_install-packages.sh.tmpl script is a chezmoi template that:
- Detects the operating system
- Installs required packages
- Sets up tools like Oh My Zsh and Starship
When modifying this script:
- Ensure it remains idempotent (safe to run multiple times)
- Test on all supported platforms
- Add appropriate error handling
- Document any new dependencies
Use chezmoi templates for platform-specific settings:
{{ if eq .chezmoi.os "darwin" }}
# macOS-specific configuration
{{ else if eq .chezmoi.os "linux" }}
# Linux-specific configuration
{{ end }}Before committing changes:
- Test in a clean environment: Use a virtual machine or container
- Run the installation script: Test the complete installation process
- Verify functionality: Ensure all tools and configurations work as expected
See docs/VMWARE_TESTING_GUIDE.md for detailed instructions on testing with VMware Fusion or UTM.
Quick test procedure:
- Create a fresh VM (macOS or Ubuntu)
- Run the installation command
- Verify the shell prompt, tools, and configurations
- Test Oh My Zsh plugins and Starship prompt
Future: CI/CD pipelines will automatically test changes on:
- macOS (via GitHub Actions)
- Ubuntu (via GitHub Actions)
- Follow Google Shell Style Guide
- Use
shellcheckfor linting:shellcheck script.sh - Use
set -efor error handling in critical scripts - Add comments for complex logic
- Keep
.zshrcorganized and well-commented - Group related settings together
- Document any non-obvious configurations
- Test compatibility across Zsh versions
Follow conventional commit format:
<type>(<scope>): <description>
[optional body]
[optional footer]
Types:
feat: New feature or configurationfix: Bug fixdocs: Documentation changesrefactor: Code restructuringtest: Adding or updating testschore: Maintenance tasks
Examples:
feat(zsh): add git aliases for common workflows
fix(install): correct Ubuntu package installation
docs(readme): update installation instructions
When adding a new tool to the dotfiles:
- Update the installation script: Add the tool to
run_once_install-packages.sh.tmpl - Add configuration: Create the config file in the appropriate location
- Document: Update README.md with information about the tool
- Test: Verify installation on all platforms
- Update specs: Add to the relevant specification file
Example for adding a new tool:
# In run_once_install-packages.sh.tmpl
install_newtool() {
echo "Installing newtool..."
if command -v newtool &> /dev/null; then
echo "newtool is already installed"
return 0
fi
case $OS in
"Darwin")
brew install newtool
;;
"Linux")
# Ubuntu/Debian
apt-get install -y newtool
;;
esac
}This repository uses age encryption for secrets:
- Never commit plaintext secrets
- Use age encryption:
chezmoi encrypt <file> - Document secret requirements: Update README.md if new secrets are needed
- Highly sensitive secrets: Keep in Bitwarden, not in the repository
# Create or edit the secret file
chezmoi edit ~/.config/secret-file
# Encrypt it (chezmoi does this automatically for .age files)
# The file will be stored as home/dot_config/secret-file.agePerform these tasks regularly:
- Update dependencies: Keep Oh My Zsh, Starship, and other tools updated
- Review plugins: Check if Oh My Zsh plugins need updates
- Test installations: Periodically test on fresh VMs
- Update documentation: Keep README and guides current
# Update Oh My Zsh
omz update
# Update plugins
cd ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git pull# macOS
brew upgrade starship
# Linux
curl -sS https://starship.rs/install.sh | shIssue: Installation script fails on a specific OS
- Solution: Check OS detection logic and platform-specific commands
Issue: Shell prompt doesn't appear correctly
- Solution: Verify Starship installation and configuration
Issue: Oh My Zsh plugins not working
- Solution: Ensure plugins are properly sourced in
.zshrc
Issue: Secret decryption fails
- Solution: Verify age key is present at
~/.config/chezmoi/key.txt
- Review the README.md for general information
- Check docs/ for detailed guides
- Review specs/ for feature specifications
- Open an issue for bugs or questions
These dotfiles follow these principles:
- Idempotence: Scripts should be safe to run multiple times
- Portability: Work consistently across macOS, Linux, and WSL
- Security: Never expose secrets in version control
- Modularity: Keep configurations organized and maintainable
- Simplicity: Prefer straightforward solutions over complex ones
Thank you for contributing to making these dotfiles better!