Published
- 3 min read
Introduction: Shit Hot Dotfiles
Link Copied!
Share away.
What are dotfiles
You’ve probably seen them before, files like .gitconfig
+ .ssh/config
+ .zshrc
are considered dotfiles
They contain configuration for tooling running on your host which modifies how the tooling behaves
What problem does this solve
- Version control your machine config
- Automated setup of your machine setup
- Cross-platform support
Linux
+MacosX
+WSL
- Easy to switch between different dotfile repositories
- Test yer pals dotfiles so you can slag thier shit setup then revert back to your own
Chezmoi is a shit hot tool that enables all this and it really cool 10/10
Prerequisites
- Working knowlegde with git
- Unix based CLI
Getting Started
The general idea is to store local tooling configuration into a git repo via chezmoi
- First, Install Chezmoi
- Create a git repo called
dotfiles
- Run
chezmoi init
to provision a local repo located at~/.local/share/chezmoi
- Run
chezmoi add ~/.zshrc
to add your first host file to your new local repo - Run
chezmoi cd
to head over to your local dotfile repo - Configure local repo remote origin
git remote add origin [email protected]:<uname>/dotfiles.git
git branch -M main
git add .
git commit -m "feat(zsh): inital commit of .zshrc file"
git push -u origin main
Congrats, you just committed your first dotfile 🎉
Tracking Changes
chezmoi edit ~/.zshrc
chezmoi -v apply
chezmoi cd
git add .
git commit -m "feat(zsh): updated .zshrc with alias"
git push
Its the circle of life
SSH keys
This topic has a dependancy on a 1Password account
Coupling Chezmoi with a password manager is another really powerfull feature that I love
Instead of generating new SSH keys each time you move machine, you can store SSH keys into your password vault and configure your SSH agent to read your keys from the password vault
Meaning you can clear out all your keys in ~/.ssh
See here for how to configure
Homebrew
I find homebrew pretty slow but its nice that you can install it on Linux
+ MacosX
+ WSL
This provides us a constant way to manage our dependencies and tooling, using 1 tool across 3 different operating systems
Yum
ZSH
I run ZSH which is a Unix shell built ontop of bash, it has many features
I mainly use it for
- automatic cd
- themes and plugin support via oh-my-zsh framework
# before
cd ~/dev/kolvin/projects
# after
~/dev/kolvin/projects
Although @electrocally is trying to pull me over to fish which i am interested in learning
Vscode Settings
Another cool benifit is tracking your vscode settings.json
As mentioned above, if you track changes to move to a new machine then youll noticed your configuration gets applied
But with the caveat that the settings.json file location is different per different operating system, ive still to implement support for this in my own repo for both Linx
+ WSL
Currely using MacosX
the most
But VScode also offers a native solution to this called settings sync