Fonts: Difference between revisions

imported>Verhovsky
No edit summary
imported>Feliix42
Adapt instructions for 20.09, overriding the nerdfont selection does not require an overlay anymore
Line 23: Line 23:


=== Installing specific fonts from nerdfonts ===
=== Installing specific fonts from nerdfonts ===
You probably want to install some fonts from the [https://www.nerdfonts.com/ nerdfonts] repository and not the entire repository (it takes a lot of time to install all the fonts). To achieve that on stable 20.03, you can use an overlay created by [https://github.com/lightdiscord/nix-nerd-fonts-overlay# LightDiscord]. Here is an example of how to use it:
The <code>nerdfonts</code> package, which contains all fonts from the [https://www.nerdfonts.com/ nerdfonts] repository is quite large and conrains a large number of fonts which take some time to install. If you only need a selection of fonts from the package, you can overwrite the font selection on Stable 20.09 like so:
<syntaxhighlight lang="nix">
{ pkgs, ... }:
{
  nixpkgs.overlays = [ (import ./nix-nerd-fonts-overlay/default.nix) ]; # Assuming you cloned the repository to the same directory
  fonts.fonts = with pkgs; [
    nerd-fonts.firacode
    nerd-fonts.jetbrainsmono
    nerd-fonts.droidsansmono
  ];
}
</syntaxhighlight>
 
This will cause NixOS to download only [https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/FiraCode Fira Code], [https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/JetBrainsMono Jetbrains Mono] 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.


On unstable however, there's a built-in option that looks like this:
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
{ pkgs, ... }:
{ pkgs, ... }:
Line 51: Line 37:
</syntaxhighlight>
</syntaxhighlight>


This will cause NixOS to download only Fira Code and Droid Sans Mono fonts from nerd-fonts instead of the whole package.
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.


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