
Managing your dotfiles or ~/.config ...
- Haggai Philip Zagury (hagzag)
- Development , Developer experience ( dev ex)
- January 2, 2024
Table of Contents
This is a common approach I adopted to manage my dotfiles
I have a priveate one meintainef in house at my company Tikal and a public one in github - here is the link to the public one: hagzag/dotfiles
Info
So a good place to start is the code which is available at hagzag/dot-config
The following is basically the repo’s README.md file which I maintain as I improove it.
Dotfiles and Development Environment Setup
A comprehensive dotfiles management system using Taskfile for automated macOS environment setup and configuration.
🎯 Features
- Automated XDG directory structure setup
- Homebrew package management with Brewfile
- Git configuration with GPG signing support
- Pre-commit hooks integration
- Bash environment configuration
- Rosetta 2 support for Apple Silicon
- EditorConfig for consistent coding styles
- Cloud provider credential management (AWS, GCP)
- VS Code configuration
🚀 Prerequisites
📥 Installation
- Install Homebrew and go-task:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install go-task
- Clone the repository:
export DOT_CONFIG_REPO=[email protected]:tikalk/users/hagzag/dot-config.git
task bash:dot_config:get
- Setup environment:
cd ~/.config
cp .env.example .env # Configure your environment variables
🛠️ Available Tasks
Basic Setup
task bash:xdg-setup
- Initialize XDG directory structure and bash configurationtask xcode:rosetta
- Install Rosetta 2 for Apple Silicon Macs
Homebrew Management
task brew:install
- Install all dependencies from Brewfiletask brew:status
- Check Brewfile status and outdated packagestask brew:dump
- Update Brewfile with current packagestask brew:cleanup
- Remove unused dependenciestask brew:commit
- Commit Brewfile changes to git
Git Configuration
task git:config:generator
- Generate git configuration (requires USER_EMAIL and USER_FULL_NAME)task git:config:from-repo
- Configure git symlinks and validation from dot-config repotask git:lfs
- Install and configure Git LFS
Security & Signing
task gnupg
- Install GnuPGtask gnupg:validate
- Validate GnuPG setup and keys
Pre-commit Hooks
task pre-commit:install
- Configure pre-commit hookstask pre-commit:run
- Run pre-commit checks on staged filestask pre-commit:run-all-files
- Run pre-commit checks on all files
IDE Configuration
task create-vscode-config
- Creates VS Code settings with Taskfile schema support
Cloud Provider Setup
AWS
task aws:tutorial:credentials
- Guide for setting up AWS credentialstask aws:validate:credentials
- Validate AWS credentials configuration
GCP
task gcp:tutorial:credentials
- Guide for setting up GCP service accounttask gcp:tutorial:login
- Interactive GCP login processtask gcp:validate:credentials
- Validate GCP credentials configuration
📁 Directory Structure
~/.config/
├── .env # environment variables part of .gitignore - intended to be used for local development
├── .env-example # Template for environment variables
├── .editorconfig # Editor configuration for consistent coding styles
├── Brewfile # Homebrew dependencies
├── Taskfile.yml # Task definitions
├── .vscode/ # VS Code configuration
├── bash/ # Bash configuration files
│ ├── env # ~/.bash_env links to this
│ ├── profile # ~/.bash_profile links to this
│ └── rc # ~/.bashrc links to this
└── git/ # Git configuration
└── .gitconfig # ~/.gitconfig links to this
⚙️ Configuration
EditorConfig
The repository includes an .editorconfig
file that maintains consistent coding styles across different editors and IDEs. It provides settings for:
- Indentation style and size
- Line endings
- Character encoding
- Language-specific configurations (Python, HTML, YAML, etc.)
Make sure your editor has EditorConfig support installed.
Environment Variables
The repository uses a .env
file for configuration. Generate it using the provided task:
task generate:dot:env \
DOT_CONFIG_REPO="your-repo-url" \
USER_FULL_NAME="Your Name" \
USER_EMAIL="[email protected]" \
USER_SIGNING_KEY="your-gpg-key"
Cloud Provider Configuration
AWS
# View AWS setup instructions
task aws:tutorial:credentials
# Validate AWS configuration
task aws:validate:credentials
GCP
# View GCP setup instructions
task gcp:tutorial:credentials
# Login to GCP
task gcp:tutorial:login
# Validate GCP configuration
task gcp:validate:credentials
🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Run pre-commit checks (
task pre-commit:run
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- go-task - Task runner
- Homebrew - Package manager
- pre-commit - Git hooks framework
- GnuPG - Encryption tools
- GitHub GPG Guide
- GitLab GPG Guide