Hands down the easiest way to manage your configuration files in a unix environment is via GNU Stow.
For some time I hesitated to set this up as I didn't "get it", but now that it is working, I would never go back to manually handling dotfiles.
Sure, one could symlink files from a repository to the various directories that they need to ultimately end up in, but those with bigger brains than I have come up with a simple way to do this. I will go over what problem is solved, and how to set this up.
The Problem
If you run multiple unix installations (Mac/Linux/BSD - on the server or desktop), you will have created settings that make you comfortable in various workflows, as well as use programs consistently that you would like to look, feel, and act in certain ways. This takes time to setup, but you want to be able to replicate it again and again on your machines, be able to iterate and improve upon the setup, and then have these changes reflected on your machines in the future. This is technically quite easy to do, you have your ~/.config directory with these settings, and then source control it.
The problem is that there are, in many cases, dozens of directories that need to be controlled, and this gets hairy, especially if the program is not XDG compliant (though most are).
The solution
GNU Stow solves this very simply - take those files that you need for configuration, put them into one version controlled directory, and symlink those files to where they need to go in your filesystem. I will give an example of my own Stow directory to give visual understanding of this below.
Install and run stow
sudo dnf install stow
Create a directory where your dotfiles will live, I called mine "dotfiles":
mkdir dotfiles
cd dotfiles
In this directory, we will want to create the various configuration files, using a very simple structure. Let's take my doom emacs config as an example:
doom
└── .config
└── doom
├── config.el
├── custom.el
├── elfeed.org
├── init.el
├── packages.el
├── README.md
├── snippets
│ ├── org-mode
│ │ ├── cb
│ │ ├── cbg
│ │ ├── cbs
│ │ └── Codeblock Org
│ └── +web-react-mode
│ └── React Functional Component
├── templates
│ ├── note-template.el
│ └── writing-template.el
└── themes
├── logos-theme.el
└── nowhere-theme.el
We will then simply cd to the root of our dotfiles directory and type:
stow doom
This will create a symlink from our stow directory to ~/.config/doom. All dotfiles can now be managed in a single place, without the need to copy files anywhere. When setting up a new machine, clone this dotfiles repo, run:
stow *
and be on your way!
In the future, I will be adding in a nix configuration for reproducible builds on mac and linux, in an effort to treat my computers less like pets, and more like cattle, but this works very nicely as a way to handle the program specific configurations.
As always, God bless, and until next time.
If you enjoyed this post, consider supporting my work by Buying me a Coffee, Checking out my book, or sending me an email to tell me what you think.