Fonts: Difference between revisions

Rczb (talk | contribs)
Rc-zb (talk | contribs)
Line 41: Line 41:
This will cause NixOS to download only the [https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/FiraCode Fira Code] and [https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/DroidSansMono Droid Sans Mono] fonts from [https://github.com/ryanoasis/nerd-fonts nerd-fonts] instead of the whole package. The relevant names can be found by looking at the file name for your relevant font on the [https://github.com/ryanoasis/nerd-fonts/releases official release page] assets.
This will cause NixOS to download only the [https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/FiraCode Fira Code] and [https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/DroidSansMono Droid Sans Mono] fonts from [https://github.com/ryanoasis/nerd-fonts nerd-fonts] instead of the whole package. The relevant names can be found by looking at the file name for your relevant font on the [https://github.com/ryanoasis/nerd-fonts/releases official release page] assets.


=== Let Fontconfig know the fonts within your Nix user profile ===
=== Let Fontconfig know the fonts within your Nix profile ===
Nix inserts its user profile path into <code>$XDG_DATA_DIRS</code>, which Fontconfig by default doesn't look in. This cause graphical applications like KDE Plasma not able to recognize the fonts installed via <code>nix-env</code> or <code>nix profile</code>.
Nix inserts its user profile path into <code>$XDG_DATA_DIRS</code>, which Fontconfig by default doesn't look in. This cause graphical applications like KDE Plasma not able to recognize the fonts installed via <code>nix-env</code> or <code>nix profile</code>.


Line 49: Line 49:
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<fontconfig>
   <!-- Only if use-xdg-base-directories is enabled in your nix.conf; use your own $XDG_STATE_HOME in place of ~/.local/state -->
   <!-- NIX_PROFILE is the path to your Nix profile. See Nix Reference Manual for details. -->
   <dir>~/.local/state/nix/profile/share/fonts</dir>
   <dir>NIX_PROFILE/lib/X11/fonts</dir>
   <dir>~/.nix-profile/share/fonts</dir>
   <dir>NIX_PROFILE/share/fonts</dir>
</fontconfig>
</fontconfig>
</syntaxhighlight>
</syntaxhighlight>
and run <code>fc-cache</code>.
and run <code>fc-cache</code>.


Alternatively, set <code>fonts.fontconfig.enable = true;</code> in your Home Manager configuration.
Alternatively, [https://nix-community.github.io/home-manager/options.xhtml#opt-fonts.fontconfig.enable enable Fontconfig configuration] in your Home Manager configuration.


=== Imperative installation of user fonts ===
=== Imperative installation of user fonts ===