Jump to the navigation menu

Managing dotfiles with Nix

As well as Nix managing packages and NixOS as your operating system, you can use Nix to manage your user configuration and dotfiles.

Enter, Home Manager.

Home Manager is available as a module for NixOS and a standalone package for other Linux distributions and macOS.

With it, you can install and configure programs for specific users and create and manage dotfiles such as .gitconfig, .tmux.conf and .zshrc instead of using a tool like Stow.

There's also the extra benefit that you can write these files in the Nix language and only focus on one configuration language.

Nix and Home Manager will create the desired output file in whatever the program wants, whether it's JSON, ini, YAML or something else.

A good example is my .gitconfig configuration. It includes settings for Git itself, aliases, global excludes, adds extra packages such as git-instafix and some environment variables.

All in one file and all in one language.

- Oliver

Was this interesting?

Sign up here and get more like this delivered straight to your inbox every day.

About me

Picture of Oliver

I'm an Acquia-certified Drupal Triple Expert with 18 years of experience, an open-source software maintainer and Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.