Home-Manager Nerdfonts

I’m quite new to NixOS and the home-manager.

I would like to install a specific font from the nerdfonts package on the user-level, in my home.nix file.

As far as I understand, the /etc/nixos/configuration.nix is for the configuration of the system/root environment, while the home-manager manages my user-specific settings like dotfiles or user privileged installation of packages.

While I’m able to install fonts on a user level via home.packages, I cant install only a specific font from nerdfonts.
From the Wiki I saw that its possible to only install a selection of fonts from the nerdfonts package but its only explained for the /etc/nixos/configuration.nix file, so for root privileges.

fonts.fonts = with pkgs; [
  (nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; })

From my understanding it would be better to install fonts on the user-level.
But if I try to use this code-snippet in my home.nix file and apply via home-manager switch, the following error appears:

error: The option `fonts.fonts' defined in `.../.config/nixpkgs/home.nix' does not exist.

There are not alot of nerdfonts patched fonts available via package manager (to be exact, theres only terminus and inconsolata beside the whole nerdfonts package).

If anyone has an idea for a solution I would be happy to hear :slight_smile:

1 Like

The options in configuration.nix are not compatible with home-manager. The available configuration options for home-manager are listed at Appendix A. Configuration Options

To install fonts you’d use

  fonts.fontconfig.enable = true;
  home.packages = [
    (pkgs.nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; })