This is a collection of the configuration files that I use with NixOS, a Linux distribution inspired by purely functional programming languages.
These configuration files reflect how I use NixOS on a daily basis; as such, they contain a lot of peculiar code not written for general use. If you find some of the techniques I use in these files to be useful, feel free to use them as a template for your own NixOS configuration.
My configuration is organized with two goals in mind: First, the configuration of several computers that I own is unified into this one repository with minimal duplication of effort. Second, everything necessary to provision a new machine from scratch is included along with a script to ease initial installation.
machines/ directory contains a separate NixOS module for each
computer that I have configured with NixOS. Since each computer is used in
different settings, it is only natural that each of these modules is slightly
A number of different configuration profiles are defined as NixOS modules in
profiles/ directory. Each computer can import any number of different
profiles. This minimizes the duplication of effort when two or more computers
are commonly used for the same tasks. For instance, if I commonly use a printer
from either my laptop or my desktop, I can import the
printing.nix profile on
those computers, while omitting it on my server.
I keep various configuration files for userland applications in the
directory. This allows me to keep the configuration files that I find
important, such as my VIM or Git configuration files, consistent across
Note that NixOS does not provide any built-in support for managing userland dotfiles. I simply create the dotfiles as symbolic links from a startup script.
I use the
install.sh script to start a new installation from scratch. The
script is not perfect, but it attempts to identify computers I own and use the
Makefile / rebuild.sh
rebuild.sh script is interesting because whenever nixrc changes are
applied by this script, the entire repository is copied to the
directory via the
rsync utility. This is useful for keeping this Git
repository in an un-privileged directory and then moving it to the appropriate
privileged directory when needed.
As this repository does not really constitute a coherent product, I am releasing everything I have written here to the public domain without warranty of any kind. Note that some of the code in this repository may have been pulled from elsewhere; such code is the property of its respective copyright holder.