
đĄ Tutorial Level: Beginner - Intermediate
You just need to have a fundamental understanding of linux (concepts such as symlinking), terminal commands, as well as a basic understanding of how GIT works
â° TL;DR
- Run the
init-dotfiles
script to set up yourdotfiles
repo- Copy over the dotfiles you would like to sync into your new
dotfiles
repo folder- Add the copied files to the link section in
install.conf.yaml
- Push up changes to Github
- Easily install on new machine with a 1 line command:
git clone [REPO_URL] && cd dotfiles && ./install
Why spend the time setting this up?
- Have you ever found yourself moving between different computers, having to re-install and re-configure software?
- Or have you ever made a configuration change, broke (or fixed) something, and forgot what you did?
- Well, no more! Using
dotbot
to manage yourdotfiles
, setting up a new system can be as easy as typing ONE LINE into the terminal!
What are DOTFILES?
- What are dotfiles?
- Dotfiles are simply text files that store configuration options for software on your computer
- Why would we want to backup our dotfiles?
- Itâs a pain to move between computers with different configurations
- Using Git combined with
dotbot
makes it super easy to keep your configuration and settings synchronized between all your computers!
- Bonus: No more digging around the filesystem trying to find the location of your configuration file for a specific programâŚeverything is located in your
~/dotfiles
folder, and then symlinked out to where it needs to go on the filesystem!
What is DOTBOT?
- Dotbot is a tool that bootstraps your dotfiles and consolidates management of configuration files into one location
- Dotbot makes installing your dotfiles as easy as pasting this one-liner into your terminal (even on a freshly installed system):
git clone $url && cd dotfiles && ./install
- Dotbot can integrate into your existing dotfiles repo if you already have one, or can be used to generate a brand new dotfiles repo.
- In this guide, weâll be creating a new dotfiles repo from scratch.
Getting started
1) Create DOTFILES repo, using the init-dotfiles
script
- Run the following command in a terminal:
curl -fsSLO <https://raw.githubusercontent.com/Vaelatern/init-dotfiles/master/init_dotfiles.sh>
chmod +x ./init_dotfiles.sh
./init_dotfiles.sh
2) Add extra files not imported by the init-dotfiles
script
-
We can easily add any number of extra configuration files for software that isnât automatically picked up by the
init-dotfiles
script. -
All of the installation options are located in the
dotfiles
folder insideinstall.conf.yaml
-
As seen in the example above, weâre going to manually add dotfiles in
install.conf.yaml
:- Software with configuration files located in the
~
home folder:zshrc
aliasrc
ackrc
- Software with configuration files located outside of the
~
home folder:~/.config/alacritty/alacritty.yml
: Alacritty (my terminal)~/.config/nvim/init.vim
: VIM/NeoVIM (my text editor)
- Software with configuration files located in the
-
We will start by copying all of these files to the
dotfiles
repo. Copy over all desired files into the.dotfiles
folder, like so:cp ~/.zshrc ~/.dotfiles/zshrc cp ~/.aliasrc ~/.dotfiles/aliasrc cp ~/.config/nvim/init.vim ~/.dotfiles/init.vim # ... continue copying over all desired files until they are all in the dotfiles repo folder
-
While you donât have to, I prefer removing the preceding
.
on the file names in thedotfiles
so they donât appear as hidden files within the synced repo. However, when theyâre linked out, theyâll become hidden dotfiles as normal.
3) Installing on a new system
- Simply run the following command to download your dotfiles repo and automatically run the install script:
git clone [REPO_URL] && cd dotfiles && ./install
4) Testing & fixing errors
-
As can be seen in the video, the
install
process ran into a couple of errors with the manually added files foralacritty
&nvim
.- This is because all of the subfolders donât exist yet, so the configuration file path listed in
install.conf.yaml
doesnât exist yet. - However, this can easily be fixed by a simple configuration option for
links
calledcreate
. - Complete documentation can be found here
- This is because all of the subfolders donât exist yet, so the configuration file path listed in
-
To fix, we can set the default
create
link option for our files which arenât located directly in the home folder. This option creates parent folders as necessary-
While weâre at it, letâs also add a default to force overwriting config files to ensure all mapped files are always in sync after running the install script:
- defaults: link: create: true force: true
-
-
After adding these changes, we can push the changes up to Github, pull the changes on the new system, and try again to verify it works
6) The final install.conf.yaml
- defaults:
link:
create: true
force: true
- clean: ['~']
- link:
~/.tmux.conf.local: tmux.conf.local
~/.zshrc: zshrc
~/.aliasrc: aliasrc
~/.config/alacritty/alacritty.yml: alacritty.yml
~/.config/nvim/init.vim: init.vim
~/.ackrc: ackrc
BONUS: Extra options, custom install scripts, and more
- You can also add any number of shell commands to be ran during the install process:
- shell:
- chsh -s $(which zsh)
-
command: read var && echo Your variable is $var
stdin: true
stdout: true
description: Reading and printing variable
quiet: true
- I didnât personally add this for my install script because I might be installing on systems other than Manjaro/Arch Linux, and I wanted to make an agnostic install script. Instead, I created my own
MANJARO_INSTALL
directory with personalized scripts I can run on install. All I have to do is typeINSTALL.sh
on a new machine, and it will automatically download all of my software and install it while I drink a nice cuppa tea â - Now that our configurations have been loaded, I can run this install script to automatically download and install all of the desired software packages. If going this route, re-run the
dotbot
install script in your dotfile repo to make sure your configuration files arenât overwritten by the install process. - It is actually preferable to install all software first, then run
dotbot
__âs install script to set up the configuration files. This is a better order of operations and the one I recommend (since this tutorial is primarily focused on syncing dotfiles, thedotbot
install script was ran before installing packages for this example)
My Personal Install Scripts
Below are some of my Custom Manjaro Install scripts that I can run on any fresh Manjaro OS. A complete list can be found at the link to the repo at the end of this article.
INSTALL_PACKAGES.sh
#!/bin/sh
sudo pacman -Syu # Download & update mirrors
sudo pacman -S yay # Install YAY package manager
yay -S base-devel # Install base development packages, which are helpful for installing other packages
yay -S "$(cat INSTALL_PACKAGES.txt | xargs)" # Install list of all packages
INSTALL.sh
#!/bin/bash
# Runs install & configuration scripts
./INSTALL_PACKAGES.sh
./configureZsh.sh
./configureTmux.sh
INSTALL_PACKAGES.txt
ack
alacritty
android-tools
autojump-git
balena-etcher
bat
broot
chars
coreutils
cowsay
fd
feh
ffmpeg
firefox-developer-edition
fortune-mod
fzf
gimp
git
google-chrome
hack-font-ligature-nerd-font-git
imagemagick
interception-caps2esc
interception-tools
jq
lsd
neovim
nodejs
notion-app
npm
obs-studio
oneko
shellcheck
speedtest-cli
the_silver_searcher
thefuck
tig
tldr
tmux
toilet
tusk
vlc
wireshark-cli
wireshark-qt
xclip
zathura
zathura-djvu
zathura-pdf-mupdf
zathura-ps
zeal
zsh
zsh-completions
cmatrix
expressvpn
whatip-git