For the last few years, I’ve been experimenting with ways to rebuild my workstation set up quickly and easily. In the event of a disaster or migrating to a new machine, I can get back to a productive state quickly!

I’ve tried or read into many possible solutions, from simple shell scripts to NixOS, but I now believe I’ve found a solution that works well for my needs.

My Needs

After some experimentation and thought, I came up with the following requirements:

  • Install desired software (packages).
  • Set necessary configuration (dotfiles).
  • Work for mainstream OS distributions.
  • Allow for me to support multiple targets if required.
  • It must not require too much setup and maintenance.

So installing software and setting configuration is reasonably self-explanatory. Still, on the other points, I wish to work with standard OS distributions and have a solution that works with multiple targets if required. This requirement is because I use Linux workstations personally, but I may not have this choice in the workplace. Lastly, I don’t want the maintenance for this solution to distract from actual work.

My Solution

The solution I’ve come to in the end has been to manage my dotfiles using chezmoi and install software, configure my machine and initialise those dotfiles with Ansible.

You can check out my dotfiles repository and the Ansible repository. Still, to explain what’s done here, the Ansible playbook performs any OS-specific, one time configurations, the little tweaks that I want to be done on this OS regardless of anything else. Then it will install or remove software packages from various package sources and then configure my set up my shell and bring in my dotfiles.

Chezmoi also does some heavy lifting here. It not only takes care of the dotfiles but also pulls in external repositories the configuration is dependent on, such as oh-my-zsh.

Conclusion

For me, this solution strikes a good balance. It’s flexible yet doesn’t need a tremendous amount of maintenance. I can continue to use whatever OS distribution I like, and if I choose, I can extend this to support my work machine. But for now, I’ll bring only my dotfiles to work.