diff options
author | Eric Sagnes <eric.sagnes@gmail.com> | 2016-08-11 08:45:43 +0900 |
---|---|---|
committer | Nikolay Amiantov <ab@fmap.me> | 2016-08-20 03:21:05 +0300 |
commit | e80e8b9dc95fd21de14bd4647cb957765030aa59 (patch) | |
tree | 61fd467e66df44cf7ad431f2825584b457783c9c | |
parent | cd2948a72e3116a3a42f1f523fe2638db994362c (diff) |
fontconfig module: respect upstream definitions
-rw-r--r-- | nixos/modules/config/fonts/fontconfig.nix | 61 | ||||
-rw-r--r-- | pkgs/development/libraries/fontconfig/default.nix | 1 |
2 files changed, 37 insertions, 25 deletions
diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix index 6494e09111d4..770c3a03f9d8 100644 --- a/nixos/modules/config/fonts/fontconfig.nix +++ b/nixos/modules/config/fonts/fontconfig.nix @@ -12,8 +12,6 @@ This module generates a package containing configuration files and link it in /e Fontconfig reads files in folder name / file name order, so the number prepended to the configuration file name decide the order of parsing. Low number means high priority. -Default fonts should have a high priority (low number) to be at the head of the preferred fonts list, fontconfig advise the 30~40 range. - */ { config, lib, pkgs, ... }: @@ -109,9 +107,13 @@ let cfg = config.fonts.fontconfig; </fontconfig> ''; - # prefered default fonts configuration file - # priority 30 - genericAliasConf = + # local configuration file + # priority 51 + localConf = pkgs.writeText "fc-local.conf" cfg.localConf; + + # default fonts configuration file + # priority 52 + defaultFontsConf = let genDefault = fonts: name: optionalString (fonts != []) '' <alias> @@ -125,7 +127,7 @@ let cfg = config.fonts.fontconfig; </alias> ''; in - pkgs.writeText "fc-30-nixos-generic-alias.conf" '' + pkgs.writeText "fc-52-nixos-default-fonts.conf" '' <?xml version='1.0'?> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> <fontconfig> @@ -140,17 +142,6 @@ let cfg = config.fonts.fontconfig; </fontconfig> ''; - # user settings configuration file - # priority 99 - userConf = pkgs.writeText "fc-99-user.conf" '' - <?xml version="1.0"?> - <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> - <fontconfig> - <include ignore_missing="yes" prefix="xdg">fontconfig/conf.d</include> - <include ignore_missing="yes" prefix="xdg">fontconfig/fonts.conf</include> - </fontconfig> - ''; - # fontconfig configuration package confPkg = pkgs.runCommand "fontconfig-conf" {} '' support_folder=$out/etc/fonts @@ -170,6 +161,13 @@ let cfg = config.fonts.fontconfig; ln -s ${latestPkg.out}/etc/fonts/conf.d/*.conf \ $latest_folder/conf.d/ + # update latest 51-local.conf path to look at the latest local.conf + rm $latest_folder/conf.d/51-local.conf + + substitute ${latestPkg.out}/etc/fonts/conf.d/51-local.conf \ + $latest_folder/conf.d/51-local.conf \ + --replace local.conf /etc/fonts/${latestVersion}/local.conf + # 00-nixos-cache.conf ln -s ${cacheConfSupport} \ $support_folder/conf.d/00-nixos-cache.conf @@ -179,15 +177,21 @@ let cfg = config.fonts.fontconfig; ln -s ${renderConf} $support_folder/conf.d/10-nixos-rendering.conf ln -s ${renderConf} $latest_folder/conf.d/10-nixos-rendering.conf - # 30-nixos-generic-alias.conf - ln -s ${genericAliasConf} $support_folder/conf.d/30-nixos-generic-alias.conf - ln -s ${genericAliasConf} $latest_folder/conf.d/30-nixos-generic-alias.conf + # 50-user.conf + ${optionalString (! cfg.includeUserConf) '' + rm $support_folder/conf.d/50-user.conf + rm $latest_folder/conf.d/50-user.conf + ''} - # 99-user.conf - ${optionalString cfg.includeUserConf '' - ln -s ${userConf} $support_folder/conf.d/99-user.conf - ln -s ${userConf} $latest_folder/conf.d/99-user.conf + # local.conf (indirect priority 51) + ${optionalString (cfg.localConf != "") '' + ln -s ${localConf} $support_folder/local.conf + ln -s ${localConf} $latest_folder/local.conf ''} + + # 52-nixos-default-fonts.conf + ln -s ${defaultFontsConf} $support_folder/conf.d/52-nixos-default-fonts.conf + ln -s ${defaultFontsConf} $latest_folder/conf.d/52-nixos-default-fonts.conf ''; # Package with configuration files @@ -241,6 +245,15 @@ in ''; }; + localConf = mkOption { + type = types.lines; + default = ""; + description = '' + System-wide customization file contents, has higher priority than + <literal>defaultFonts</literal> settings. + ''; + }; + defaultFonts = { monospace = mkOption { type = types.listOf types.str; diff --git a/pkgs/development/libraries/fontconfig/default.nix b/pkgs/development/libraries/fontconfig/default.nix index f18ea5948f15..74048afe731e 100644 --- a/pkgs/development/libraries/fontconfig/default.nix +++ b/pkgs/development/libraries/fontconfig/default.nix @@ -66,7 +66,6 @@ stdenv.mkDerivation rec { postInstall = '' cd "$out/etc/fonts" - rm conf.d/{50-user,51-local}.conf "${libxslt.bin}/bin/xsltproc" --stringparam fontDirectories "${fontbhttf}" \ --stringparam fontconfigConfigVersion "${configVersion}" \ --path $out/share/xml/fontconfig \ |