Fonts: Difference between revisions

m Add instructions that would have helped me :)
Flukx (talk | contribs)
copy from nixos.wiki: how to in nix-shell
 
Line 119: Line 119:
fc-list -v | grep -i source
fc-list -v | grep -i source
</syntaxhighlight>
</syntaxhighlight>
=== Install fonts in nix-shells ===
<code>fonts</code> is not available as set-valued option in <code>mkshell</code> (gives you an error because it tries to coerce an attribute set into a string). Instead, insert the following:<ref>ihttps://programming.dev/post/32484220</ref>
<syntaxhighlight lang="nix">
{pkgs ? import <nixpkgs> {} }:
let
  fontsConf = pkgs.makeFontsConf {
    fontDirectories = [
      # your needed fonts here, e.g.:
      pkgs.font-awesome
      pkgs.atkinson-hyperlegible-next
    ];
  };
in
  pkgs.mkShell {
    packages = with pkgs; [
      # your font-dependent packages, e.g.:
      typst
    ];
    shellHook = ''
      export FONTCONFIG_FILE="${fontsConf}"
    '';
  }
</syntaxhighlight>
Then <code>typst fonts</code> finds the installed fonts in the nix-shell.


== Configuring fonts ==
== Configuring fonts ==