8

If I try something like

nix-env --install nixpkgs.fira-code

the package will be installed but the font will not be available anywhere.

How do I install fonts and make them available for use in Ubuntu using Nix?

Marcelo Lazaroni
  • 9,819
  • 3
  • 35
  • 41
  • Depends a lot on your setup ... you're using `nix` as a user running in Ubuntu? Then you probably need to add a path from your profile (with the fonts) to whatever font search path you're using. – Daniel Jour Sep 17 '19 at 21:14
  • @DanielJour can you add an example of how that would be done? My set up is exactly as you described (using Nix as a user running in Ubuntu). – waldyrious Aug 01 '21 at 11:22

1 Answers1

7

I had the same question, and asked it in the NixOS Discourse. The solution is to manually add Nix's font directory to the user's fontconfig (as described here), like this:

  • Create the local fontconfig directory:

    $ mkdir -p ~/.config/fontconfig/conf.d/
    
  • Create a file in that directory (called, for example, 10-nix-fonts.conf) specifying where to locate the Nix fonts:

    <?xml version='1.0'?>
    <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
    <fontconfig>
      <dir>~/.nix-profile/share/fonts/</dir>
    </fontconfig>
    
waldyrious
  • 3,683
  • 4
  • 33
  • 41