Fonts: Difference between revisions
Updated information. |
Clarify that bindfs solution can also fix issues with missing icons/cursor themes. Simplify code example. |
||
| Line 164: | Line 164: | ||
=== Flatpak applications can't find system fonts === | === Flatpak applications can't find system fonts === | ||
To expose available fonts under <code>/run/current-system/sw/share/X11/fonts</code>, enable <code>fontDir</code> in your NixOS configuration. | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
fonts.fontDir.enable = true; | fonts.fontDir.enable = true; | ||
</syntaxhighlight> | </syntaxhighlight>You will then need to link/copy this folder to one of the Flatpak-supported locations - see below. | ||
==== Best Solution: Just copy necessary fonts to <code>$HOME/.local/share/fonts</code> ==== | ==== Best Solution: Just copy necessary fonts to <code>$HOME/.local/share/fonts</code> ==== | ||
| Line 225: | Line 225: | ||
It is important to keep in mind that some flatpak apps may refuse to launch if given certain permissions, such as the Steam flatpak. | It is important to keep in mind that some flatpak apps may refuse to launch if given certain permissions, such as the Steam flatpak. | ||
=== Using bindfs for | ==== Using bindfs for fonts/cursors/icons support ==== | ||
Alternatively, you can expose relevant packages directly under <code>/usr/share/...</code> paths. This will also enable Flatpak to use a custom cursor theme if you have one.<syntaxhighlight lang="nix"> | |||
system.fsPackages = [ pkgs.bindfs ]; | |||
fileSystems = let | fileSystems = let | ||
mkRoSymBind = path: { | mkRoSymBind = path: { | ||
| Line 235: | Line 235: | ||
options = [ "ro" "resolve-symlinks" "x-gvfs-hide" ]; | options = [ "ro" "resolve-symlinks" "x-gvfs-hide" ]; | ||
}; | }; | ||
aggregated = pkgs.buildEnv { | |||
name = "system-fonts-and-icons"; | |||
paths = config.fonts.packages ++ (with pkgs; [ | |||
# Add your cursor themes and icon packages here | |||
bibata-cursors | |||
gnome.gnome-themes-extra | |||
# etc. | |||
]); | |||
pathsToLink = [ "/share/fonts" "/share/icons" ]; | |||
}; | }; | ||
in { | in { | ||
"/usr/share/ | "/usr/share/fonts" = mkRoSymBind "${aggregated}/share/fonts"; | ||
"/usr | "/usr/share/icons" = mkRoSymBind "${aggregated}/share/icons"; | ||
}; | }; | ||
fonts | fonts.packages = with pkgs; [ | ||
noto-fonts | |||
noto-fonts-emoji | |||
noto-fonts-cjk | |||
]; | |||
</syntaxhighlight> | </syntaxhighlight> | ||