Fonts: Difference between revisions
m changed the example font configuration ('noto-fonts-cjk' has been renamed renamed to 'noto-fonts-cjk-sans') |
Isabelroses (talk | contribs) m make it clearer what nix-instantiate is doing to filter out the nerdfonts |
||
| (One intermediate revision by one other user not shown) | |||
| Line 29: | Line 29: | ||
* <code>fonts.enableGhostscriptFonts</code>: affects the <code>ghostscript</code> package. Ghostscript packages some URW fonts for the standard PostScript typefaces. If <code>true</code>, these fonts will be visible to GUI applications. You could set it to <code>true</code> if you want these fonts, but <code>gyre-fonts</code> (part of <code>fonts.enableDefaultPackages</code>) might be higher-quality depending on your judgement. | * <code>fonts.enableGhostscriptFonts</code>: affects the <code>ghostscript</code> package. Ghostscript packages some URW fonts for the standard PostScript typefaces. If <code>true</code>, these fonts will be visible to GUI applications. You could set it to <code>true</code> if you want these fonts, but <code>gyre-fonts</code> (part of <code>fonts.enableDefaultPackages</code>) might be higher-quality depending on your judgement. | ||
=== Installing | === Installing <code>nerdfonts</code> === | ||
Individual Nerd Fonts can be installed like so: | |||
<syntaxhighlight lang="nix">fonts.packages = with pkgs; [ | |||
nerd-fonts.fira-code | |||
nerd-fonts.droid-sans-mono | |||
];</syntaxhighlight> | |||
< | The available Nerd Font subpackages can be listed by searching for {{nixos:package|nerd-fonts.*}} on the [[Searching packages|NixOS Package Search]] or by running the following command: <pre>nix-instantiate --eval --expr "with (import <nixpkgs> {}); lib.attrNames (lib.filterAttrs (_: lib.isDerivation) nerd-fonts)"</pre> | ||
</ | |||
==== Installing all <code>nerdfonts</code> ==== | |||
Installing all fonts from the [https://www.nerdfonts.com/ Nerd Fonts repository] is as simple as adding all of the individual packages to the NixOS configuration. The following line will do exactly that, by searching for all derivations under the <code>nerd-font</code> attribute:{{file|/etc/nixos/configuration.nix|nix|<nowiki> | |||
fonts.packages = | { | ||
fonts.packages = builtins.filter lib.attrsets.isDerivation (builtins.attrValues pkgs.nerd-fonts) | |||
} | |||
</nowiki>}} | |||
</ | |||
=== Let Fontconfig know the fonts within your Nix profile === | === Let Fontconfig know the fonts within your Nix profile === | ||