summary refs log tree commit diff
path: root/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2020-05-27 04:35:25 +0200
committerJan Tojnar <jtojnar@gmail.com>2020-07-11 17:05:13 +0200
commitedf2541f02c6b24ea791710d5cadeae36f9b1a3a (patch)
tree50ef176eaac36545ed21e9c1775a764f114641ed /pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
parent87786bc47f70646fefcbb1dbafd7d7326b97fc7b (diff)
downloadnixpkgs-edf2541f02c6b24ea791710d5cadeae36f9b1a3a.tar
nixpkgs-edf2541f02c6b24ea791710d5cadeae36f9b1a3a.tar.gz
nixpkgs-edf2541f02c6b24ea791710d5cadeae36f9b1a3a.tar.bz2
nixpkgs-edf2541f02c6b24ea791710d5cadeae36f9b1a3a.tar.lz
nixpkgs-edf2541f02c6b24ea791710d5cadeae36f9b1a3a.tar.xz
nixpkgs-edf2541f02c6b24ea791710d5cadeae36f9b1a3a.tar.zst
nixpkgs-edf2541f02c6b24ea791710d5cadeae36f9b1a3a.zip
fontconfig: Only read versioned config dirs
Falling back to unversioned `/etc/fonts/conf.d` when versioned one does not exist
is problematic since it only occurs on non-NixOS systems and those are likely
to have a different version of fontconfig. When those versions use incompatible
elements in the config, apps using fontconfig will crash.

Instead, we are now falling back to the in-package `fonts.conf` file that loads
both the versioned global `conf.d` directory and the in-package `conf.d` since using
upstream settings on non-NixOS is preferable to not being able to use apps there.

In fact, we would not even need to link `fonts.conf`, as the in-package `fonts.conf`
will be always used unless someone creates the global one manually (the option is still
retained if one wants to write a custom NixOS module and to avoid unnecessary stat call on NixOS).

Additionally, since the `fonts.conf` will always load `conf.d` from the package, we no longer
need to install them to sytem `/etc` in the module. This needed some mucking with `50-user.conf`
which disables configs in user directories (a good thing IMO, NixOS module will turn it back on)
but otherwise, it is cleaner. The files are still prioritized by their name, regardless of their location.

See https://github.com/NixOS/nixpkgs/pull/73795#issuecomment-634370125 for more information.
Diffstat (limited to 'pkgs/development/libraries/fontconfig/make-fonts-conf.xsl')
-rw-r--r--pkgs/development/libraries/fontconfig/make-fonts-conf.xsl3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl b/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
index dddbbe9e516..199cd1fd9e9 100644
--- a/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
+++ b/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
@@ -31,6 +31,9 @@
       <!-- versioned system-wide config -->
       <include ignore_missing="yes">/etc/fonts/<xsl:value-of select="$fontconfigConfigVersion" />/conf.d</include>
 
+      <!-- upstream config -->
+      <include><xsl:value-of select="$fontconfig" />/etc/fonts/conf.d</include>
+
       <dir prefix="xdg">fonts</dir>
       <xsl:for-each select="str:tokenize($fontDirectories)">
         <dir><xsl:value-of select="." /></dir>