Nerdfonts install via flakes (nix-darwin)

I’m setting up a new flake from scratch (really from the nix-Darwin simple flake), and I am trying to install the JetBrainsMono nerd font.

The NixOS wiki says that you can override the installs to specific fonts (my flake.nix uses this config for JetBrainsMono):

fonts.packages = with pkgs; [
    (nerdfonts.override { fonts = [ "JetBrainsMono" ]; })
]

However, when I attempt to use this override the rebuild returns the following error:

error: nerdfonts has been separated into individual font packages under the namespace nerd-fonts

I tried searching around for the nerd-fonts namespace being mentioned, but I am a bit lost since I cannot find an updated wiki/doc for the new namespace changes. It looks like this change may have happened somewhat recently, if I can follow the source package docs properly(?).

Is there a new config/doc that explains how to install nerd fonts?

Amazing! I tried pretty much every combo but this one, apparently… looking through my git history it was:

nerd-fonts.JetBrainsMono
nerd-fonts.jetbrainsmono
nerd-fonts.jet-brains-mono
[...]

Thank you so much!

You don’t have to blindly try in the future, you can run nix repl -f '<nixpkgs>' and then explore attributes in nixpkgs or even use tab completion:

nix-repl> nerd-fonts.              
nerd-fonts._0xproto                  nerd-fonts.code-new-roman            nerd-fonts.fira-code                 nerd-fonts.inconsolata-go            nerd-fonts.meslo-lg                  nerd-fonts.profont                   nerd-fonts.ubuntu
nerd-fonts._3270                     nerd-fonts.comic-shanns-mono         nerd-fonts.fira-mono                 nerd-fonts.inconsolata-lgc           nerd-fonts.monaspace                 nerd-fonts.proggy-clean-tt           nerd-fonts.ubuntu-mono
nerd-fonts.agave                     nerd-fonts.commit-mono               nerd-fonts.geist-mono                nerd-fonts.intone-mono               nerd-fonts.monofur                   nerd-fonts.recurseForDerivations     nerd-fonts.ubuntu-sans
nerd-fonts.anonymice                 nerd-fonts.cousine                   nerd-fonts.go-mono                   nerd-fonts.iosevka                   nerd-fonts.monoid                    nerd-fonts.recursive-mono            nerd-fonts.victor-mono
nerd-fonts.arimo                     nerd-fonts.d2coding                  nerd-fonts.gohufont                  nerd-fonts.iosevka-term              nerd-fonts.mononoki                  nerd-fonts.roboto-mono               nerd-fonts.zed-mono
nerd-fonts.aurulent-sans-mono        nerd-fonts.daddy-time-mono           nerd-fonts.hack                      nerd-fonts.iosevka-term-slab         nerd-fonts.mplus                     nerd-fonts.sauce-code-pro
nerd-fonts.bigblue-terminal          nerd-fonts.dejavu-sans-mono          nerd-fonts.hasklug                   nerd-fonts.jetbrains-mono            nerd-fonts.noto                      nerd-fonts.shure-tech-mono
nerd-fonts.bitstream-vera-sans-mono  nerd-fonts.departure-mono            nerd-fonts.heavy-data                nerd-fonts.lekton                    nerd-fonts.open-dyslexic             nerd-fonts.space-mono
nerd-fonts.blex-mono                 nerd-fonts.droid-sans-mono           nerd-fonts.hurmit                    nerd-fonts.liberation                nerd-fonts.overpass                  nerd-fonts.symbols-only
nerd-fonts.caskaydia-cove            nerd-fonts.envy-code-r               nerd-fonts.im-writing                nerd-fonts.lilex                     nerd-fonts.override                  nerd-fonts.terminess-ttf
nerd-fonts.caskaydia-mono            nerd-fonts.fantasque-sans-mono       nerd-fonts.inconsolata               nerd-fonts.martian-mono              nerd-fonts.overrideDerivation        nerd-fonts.tinos
2 Likes

TIL. I’ve been using https://search.nixos.org for everything. I’ll have to read up on how this differs, because I could not find anything in the package search for nerd-fonts, at least the way I was searching.

Because search.nixos.org is usually far behind, and in this case the change hasn’t even reached nixos-unstable yet.

2 Likes

Thank you for posting this! This helped me port over a number of nerd fonts that were named differently. If anyone else is wondering how to get the REPL to use a specific version of Nixpkgs, you can run something like this after you’ve cloned down the NixOS/nixpkgs.git locally, you can just point the nix repl command to that directory like so.

nix repl -f "/path/to/local/nixpkgs" 

This is the most helpful when want to check things that will need to be changed in your configuration if you’re stuck.