Installing fonts

Installing fonts is slightly different compared to installing regular system packages - fonts must be installed under the fonts attribute.

The general structure is as follows:

fonts.fonts = with pkgs; [
    # Fonts go here
];

Unfortunately, searching for font packages is incredibly unintuitive. Font packages look just like regular packages and adding them to the system packages does not install them properly. The 100% best safest way to find fonts is as follows:

  1. Search for the font you're looking for on the NixOS packages search website
  2. Click on the package on the website (this shows a quick description of the package, along with various other information)
  3. Make sure that the package's Nix expression starts with pkgs/data/fonts

Then, as similar to installing system packages, add the Attribute name to the fonts section:

fonts.fonts = with pkgs; [
    comic-relief
    font-awesome_4
];