From cd2948a72e3116a3a42f1f523fe2638db994362c Mon Sep 17 00:00:00 2001 From: Eric Sagnes Date: Sun, 17 Jul 2016 05:11:42 +0900 Subject: [PATCH 01/10] fontconfig: fix etc priority --- .../config/fonts/fontconfig-ultimate.nix | 166 +++++---- nixos/modules/config/fonts/fontconfig.nix | 340 +++++++++++------- .../libraries/fontconfig/default.nix | 1 - .../libraries/fontconfig/make-fonts-conf.xsl | 2 - 4 files changed, 303 insertions(+), 206 deletions(-) diff --git a/nixos/modules/config/fonts/fontconfig-ultimate.nix b/nixos/modules/config/fonts/fontconfig-ultimate.nix index 02568f9de51..3ea6e1fa53b 100644 --- a/nixos/modules/config/fonts/fontconfig-ultimate.nix +++ b/nixos/modules/config/fonts/fontconfig-ultimate.nix @@ -3,6 +3,95 @@ with lib; let fcBool = x: if x then "true" else "false"; + + cfg = config.fonts.fontconfig.ultimate; + + latestVersion = pkgs.fontconfig.configVersion; + + # fontconfig ultimate main configuration file + # priority 52 + fontconfigUltimateConf = pkgs.writeText "fc-52-fontconfig-ultimate.conf" '' + + + + + ${optionalString (!cfg.allowBitmaps) '' + + + + + false + + + + ''} + + ${optionalString cfg.allowType1 '' + + + + + + Type 1 + + + + + ''} + + + + + ${fcBool cfg.useEmbeddedBitmaps} + + + + + + + ${fcBool cfg.forceAutohint} + + + + + + + ${fcBool cfg.renderMonoTTFAsBitmap} + + + + + ''; + + # The configuration to be included in /etc/font/ + confPkg = pkgs.runCommand "font-ultimate-conf" {} '' + support_folder=$out/etc/fonts/conf.d + latest_folder=$out/etc/fonts/${latestVersion}/conf.d + + mkdir -p $support_folder + mkdir -p $latest_folder + + # 52-fontconfig-ultimate.conf + ln -s ${fontconfigUltimateConf} \ + $support_folder/52-fontconfig-ultimate.conf + ln -s ${fontconfigUltimateConf} \ + $latest_folder/52-fontconfig-ultimate.conf + + # fontconfig ultimate substitutions + ${optionalString (cfg.substitutions != "none") '' + ln -s ${pkgs.fontconfig-ultimate.confd}/etc/fonts/presets/${cfg.substitutions}/*.conf \ + $support_folder + ln -s ${pkgs.fontconfig-ultimate.confd}/etc/fonts/presets/${cfg.substitutions}/*.conf \ + $latest_folder + ''} + + # fontconfig ultimate various configuration files + ln -s ${pkgs.fontconfig-ultimate.confd}/etc/fonts/conf.d/*.conf \ + $support_folder + ln -s ${pkgs.fontconfig-ultimate.confd}/etc/fonts/conf.d/*.conf \ + $latest_folder + ''; + in { @@ -114,80 +203,11 @@ in }; + config = mkIf (config.fonts.fontconfig.enable && cfg.enable) { - config = - let ultimate = config.fonts.fontconfig.ultimate; - fontconfigUltimateConf = '' - - - + fonts.fontconfig.confPackages = [ confPkg ]; + environment.variables = cfg.rendering; - ${optionalString (!ultimate.allowBitmaps) '' - - - - - false - - - - ''} - - ${optionalString ultimate.allowType1 '' - - - - - - Type 1 - - - - - ''} - - - - - ${fcBool ultimate.useEmbeddedBitmaps} - - - - - - - ${fcBool ultimate.forceAutohint} - - - - - - - ${fcBool ultimate.renderMonoTTFAsBitmap} - - - - ${optionalString (ultimate.substitutions != "none") '' - - ${pkgs.fontconfig-ultimate.confd}/etc/fonts/presets/${ultimate.substitutions} - ''} - - ${pkgs.fontconfig-ultimate.confd}/etc/fonts/conf.d - - - ''; - in mkIf (config.fonts.fontconfig.enable && ultimate.enable) { - - environment.etc."fonts/conf.d/52-fontconfig-ultimate.conf" = { - text = fontconfigUltimateConf; - }; - - environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/52-fontconfig-ultimate.conf" = { - text = fontconfigUltimateConf; - }; - - environment.variables = ultimate.rendering; - - }; + }; } diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix index 1eaebe4b2bb..6494e09111d 100644 --- a/nixos/modules/config/fonts/fontconfig.nix +++ b/nixos/modules/config/fonts/fontconfig.nix @@ -1,7 +1,203 @@ +/* + +NixOS support 2 fontconfig versions, "support" and "latest". + +- "latest" refers to default fontconfig package (pkgs.fontconfig). + configuration files are linked to /etc/fonts/VERSION/conf.d/ +- "support" refers to supportPkg (pkgs."fontconfig_${supportVersion}"). + configuration files are linked to /etc/fonts/conf.d/ + +This module generates a package containing configuration files and link it in /etc/fonts. + +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, ... }: with lib; +let cfg = config.fonts.fontconfig; + + fcBool = x: "" + (if x then "true" else "false") + ""; + + # back-supported fontconfig version and package + # version is used for font cache generation + supportVersion = "210"; + supportPkg = pkgs."fontconfig_${supportVersion}"; + + # latest fontconfig version and package + # version is used for configuration folder name, /etc/fonts/VERSION/ + # note: format differs from supportVersion and can not be used with makeCacheConf + latestVersion = pkgs.fontconfig.configVersion; + latestPkg = pkgs.fontconfig; + + # supported version fonts.conf + supportFontsConf = pkgs.makeFontsConf { fontconfig = supportPkg; fontDirectories = config.fonts.fonts; }; + + # configuration file to read fontconfig cache + # version dependent + # priority 0 + cacheConfSupport = makeCacheConf { version = supportVersion; }; + cacheConfLatest = makeCacheConf {}; + + # generate the font cache setting file for a fontconfig version + # use latest when no version is passed + makeCacheConf = { version ? null }: + let + fcPackage = if builtins.isNull version + then "fontconfig" + else "fontconfig_${version}"; + makeCache = fontconfig: pkgs.makeFontsCache { inherit fontconfig; fontDirectories = config.fonts.fonts; }; + cache = makeCache pkgs."${fcPackage}"; + cache32 = makeCache pkgs.pkgsi686Linux."${fcPackage}"; + in + pkgs.writeText "fc-00-nixos-cache.conf" '' + + + + + ${concatStringsSep "\n" (map (font: "${font}") config.fonts.fonts)} + + ${cache} + ${optionalString (pkgs.stdenv.isx86_64 && cfg.cache32Bit) '' + ${cache32} + ''} + + ''; + + # rendering settings configuration file + # priority 10 + renderConf = pkgs.writeText "fc-10-nixos-rendering.conf" '' + + + + + + + + ${fcBool cfg.hinting.enable} + + + ${fcBool cfg.hinting.autohint} + + + hint${cfg.hinting.style} + + + ${fcBool cfg.antialias} + + + ${cfg.subpixel.rgba} + + + lcd${cfg.subpixel.lcdfilter} + + + + ${optionalString (cfg.dpi != 0) '' + + + ${toString cfg.dpi} + + + ''} + + + ''; + + # prefered default fonts configuration file + # priority 30 + genericAliasConf = + let genDefault = fonts: name: + optionalString (fonts != []) '' + + ${name} + + ${concatStringsSep "" + (map (font: '' + ${font} + '') fonts)} + + + ''; + in + pkgs.writeText "fc-30-nixos-generic-alias.conf" '' + + + + + + ${genDefault cfg.defaultFonts.sansSerif "sans-serif"} + + ${genDefault cfg.defaultFonts.serif "serif"} + + ${genDefault cfg.defaultFonts.monospace "monospace"} + + + ''; + + # user settings configuration file + # priority 99 + userConf = pkgs.writeText "fc-99-user.conf" '' + + + + fontconfig/conf.d + fontconfig/fonts.conf + + ''; + + # fontconfig configuration package + confPkg = pkgs.runCommand "fontconfig-conf" {} '' + support_folder=$out/etc/fonts + latest_folder=$out/etc/fonts/${latestVersion} + + mkdir -p $support_folder/conf.d + mkdir -p $latest_folder/conf.d + + # fonts.conf + ln -s ${supportFontsConf} $support_folder/fonts.conf + ln -s ${latestPkg.out}/etc/fonts/fonts.conf \ + $latest_folder/fonts.conf + + # fontconfig default config files + ln -s ${supportPkg.out}/etc/fonts/conf.d/*.conf \ + $support_folder/conf.d/ + ln -s ${latestPkg.out}/etc/fonts/conf.d/*.conf \ + $latest_folder/conf.d/ + + # 00-nixos-cache.conf + ln -s ${cacheConfSupport} \ + $support_folder/conf.d/00-nixos-cache.conf + ln -s ${cacheConfLatest} $latest_folder/conf.d/00-nixos-cache.conf + + # 10-nixos-rendering.conf + 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 + + # 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 + ''} + ''; + + # Package with configuration files + # this merge all the packages in the fonts.fontconfig.confPackages list + fontconfigEtc = pkgs.buildEnv { + name = "fontconfig-etc"; + paths = cfg.confPackages; + ignoreCollisions = true; + }; +in { options = { @@ -21,6 +217,15 @@ with lib; ''; }; + confPackages = mkOption { + internal = true; + type = with types; listOf path; + default = [ ]; + description = '' + Fontconfig configuration packages. + ''; + }; + antialias = mkOption { type = types.bool; default = true; @@ -142,136 +347,11 @@ with lib; }; }; + config = mkIf cfg.enable { + fonts.fontconfig.confPackages = [ confPkg ]; - config = - let fontconfig = config.fonts.fontconfig; - fcBool = x: "" + (if x then "true" else "false") + ""; - renderConf = '' - - - - - - - - ${fcBool fontconfig.hinting.enable} - - - ${fcBool fontconfig.hinting.autohint} - - - hint${fontconfig.hinting.style} - - - ${fcBool fontconfig.antialias} - - - ${fontconfig.subpixel.rgba} - - - lcd${fontconfig.subpixel.lcdfilter} - - - - ${optionalString (fontconfig.dpi != 0) '' - - - ${toString fontconfig.dpi} - - - ''} - - - ''; - genericAliasConf = '' - - - - - - ${optionalString (fontconfig.defaultFonts.sansSerif != []) '' - - sans-serif - - ${concatStringsSep "\n" - (map (font: "${font}") - fontconfig.defaultFonts.sansSerif)} - - - ''} - ${optionalString (fontconfig.defaultFonts.serif != []) '' - - serif - - ${concatStringsSep "\n" - (map (font: "${font}") - fontconfig.defaultFonts.serif)} - - - ''} - ${optionalString (fontconfig.defaultFonts.monospace != []) '' - - monospace - - ${concatStringsSep "\n" - (map (font: "${font}") - fontconfig.defaultFonts.monospace)} - - - ''} - - - ''; - in mkIf fontconfig.enable { - - # Fontconfig 2.10 backward compatibility - - # Bring in the default (upstream) fontconfig configuration, only for fontconfig 2.10 - environment.etc."fonts/fonts.conf".source = - pkgs.makeFontsConf { fontconfig = pkgs.fontconfig_210; fontDirectories = config.fonts.fonts; }; - - environment.etc."fonts/conf.d/10-nixos-rendering.conf".text = renderConf; - environment.etc."fonts/conf.d/60-nixos-generic-alias.conf".text = genericAliasConf; - - # Versioned fontconfig > 2.10. Take shared fonts.conf from fontconfig. - # Otherwise specify only font directories. - environment.etc."fonts/${pkgs.fontconfig.configVersion}/fonts.conf".source = - "${pkgs.fontconfig.out}/etc/fonts/fonts.conf"; - - environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/00-nixos.conf".text = - let - cache = fontconfig: pkgs.makeFontsCache { inherit fontconfig; fontDirectories = config.fonts.fonts; }; - in '' - - - - - ${concatStringsSep "\n" (map (font: "${font}") config.fonts.fonts)} - - ${cache pkgs.fontconfig} - ${optionalString (pkgs.stdenv.isx86_64 && config.fonts.fontconfig.cache32Bit) '' - ${cache pkgs.pkgsi686Linux.fontconfig} - ''} - - ''; - - environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/10-nixos-rendering.conf".text = renderConf; - environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/60-nixos-generic-alias.conf".text = genericAliasConf; - - environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/99-user.conf" = { - enable = fontconfig.includeUserConf; - text = '' - - - - fontconfig/conf.d - fontconfig/fonts.conf - - ''; - }; - - environment.systemPackages = [ pkgs.fontconfig ]; - - }; + environment.systemPackages = [ pkgs.fontconfig ]; + environment.etc.fonts.source = "${fontconfigEtc}/etc/fonts/"; + }; } diff --git a/pkgs/development/libraries/fontconfig/default.nix b/pkgs/development/libraries/fontconfig/default.nix index 6acf1ebce29..f18ea5948f1 100644 --- a/pkgs/development/libraries/fontconfig/default.nix +++ b/pkgs/development/libraries/fontconfig/default.nix @@ -68,7 +68,6 @@ stdenv.mkDerivation rec { cd "$out/etc/fonts" rm conf.d/{50-user,51-local}.conf "${libxslt.bin}/bin/xsltproc" --stringparam fontDirectories "${fontbhttf}" \ - --stringparam fontconfig "$out" \ --stringparam fontconfigConfigVersion "${configVersion}" \ --path $out/share/xml/fontconfig \ ${./make-fonts-conf.xsl} $out/etc/fonts/fonts.conf \ diff --git a/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl b/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl index b59fcd0187b..dddbbe9e516 100644 --- a/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl +++ b/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl @@ -28,8 +28,6 @@ /var/cache/fontconfig - - /etc/fonts/conf.d /etc/fonts//conf.d From e80e8b9dc95fd21de14bd4647cb957765030aa59 Mon Sep 17 00:00:00 2001 From: Eric Sagnes Date: Thu, 11 Aug 2016 08:45:43 +0900 Subject: [PATCH 02/10] fontconfig module: respect upstream definitions --- nixos/modules/config/fonts/fontconfig.nix | 63 +++++++++++-------- .../libraries/fontconfig/default.nix | 1 - 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix index 6494e09111d..770c3a03f9d 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; ''; - # 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 != []) '' @@ -125,7 +127,7 @@ let cfg = config.fonts.fontconfig; ''; in - pkgs.writeText "fc-30-nixos-generic-alias.conf" '' + pkgs.writeText "fc-52-nixos-default-fonts.conf" '' @@ -140,17 +142,6 @@ let cfg = config.fonts.fontconfig; ''; - # user settings configuration file - # priority 99 - userConf = pkgs.writeText "fc-99-user.conf" '' - - - - fontconfig/conf.d - fontconfig/fonts.conf - - ''; - # 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 - - # 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 + # 50-user.conf + ${optionalString (! cfg.includeUserConf) '' + rm $support_folder/conf.d/50-user.conf + rm $latest_folder/conf.d/50-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 + defaultFonts 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 f18ea5948f1..74048afe731 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 \ From 4114cf9c6c184d72d51260caa6ad0e11984fee0b Mon Sep 17 00:00:00 2001 From: Eric Sagnes Date: Thu, 11 Aug 2016 16:21:03 +0900 Subject: [PATCH 03/10] fontconfig-ultimate: fix wqy-zenhei-sharp priority --- pkgs/development/libraries/fontconfig-ultimate/confd.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/development/libraries/fontconfig-ultimate/confd.nix b/pkgs/development/libraries/fontconfig-ultimate/confd.nix index 160fef5f07e..31679aa0806 100644 --- a/pkgs/development/libraries/fontconfig-ultimate/confd.nix +++ b/pkgs/development/libraries/fontconfig-ultimate/confd.nix @@ -32,6 +32,9 @@ stdenv.mkDerivation { cp fontconfig_patches/fonts-settings/*.conf $out/etc/fonts/conf.d + # fix font priority issue https://github.com/bohoomil/fontconfig-ultimate/issues/173 + mv $out/etc/fonts/conf.d/{43,60}-wqy-zenhei-sharp.conf + mkdir -p $out/etc/fonts/presets/{combi,free,ms} cp fontconfig_patches/combi/*.conf $out/etc/fonts/presets/combi cp fontconfig_patches/free/*.conf $out/etc/fonts/presets/free From e3ab0826c2139253dc1717b8cff9aae599db2432 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Fri, 19 Aug 2016 13:14:07 +0300 Subject: [PATCH 04/10] fontconfig-ultimate: 2015-12-06 -> 2016-04-23 This removes our hardcoded presets which weren't updated for quite some time. Infinality now has new hardcoded presets in freetype, which can be overriden if desired with environment variables (as before). Accordingly, updated NixOS module to set the hardcoded preset. Additionally used a more "right" type for substitutions. --- nixos/doc/manual/release-notes/rl-1609.xml | 8 + .../config/fonts/fontconfig-ultimate.nix | 47 +--- nixos/modules/rename.nix | 3 + .../libraries/fontconfig-ultimate/confd.nix | 43 ---- .../libraries/fontconfig-ultimate/default.nix | 45 +++- .../fontconfig-ultimate/rendering.nix | 212 ------------------ 6 files changed, 63 insertions(+), 295 deletions(-) delete mode 100644 pkgs/development/libraries/fontconfig-ultimate/confd.nix delete mode 100644 pkgs/development/libraries/fontconfig-ultimate/rendering.nix diff --git a/nixos/doc/manual/release-notes/rl-1609.xml b/nixos/doc/manual/release-notes/rl-1609.xml index 8dd4e1a9f64..1245411be17 100644 --- a/nixos/doc/manual/release-notes/rl-1609.xml +++ b/nixos/doc/manual/release-notes/rl-1609.xml @@ -58,6 +58,14 @@ following incompatible changes: official documentation. + + fonts.fontconfig.ultimate.rendering was removed + because our presets were obsolete for some time. New presets are hardcoded + into freetype; one selects a preset via fonts.fontconfig.ultimate.preset. + You can customize those presets via ordinary environment variables, using + environment.variables. + + diff --git a/nixos/modules/config/fonts/fontconfig-ultimate.nix b/nixos/modules/config/fonts/fontconfig-ultimate.nix index 3ea6e1fa53b..a3f52fbd919 100644 --- a/nixos/modules/config/fonts/fontconfig-ultimate.nix +++ b/nixos/modules/config/fonts/fontconfig-ultimate.nix @@ -79,16 +79,16 @@ let fcBool = x: if x then "true" else "false"; # fontconfig ultimate substitutions ${optionalString (cfg.substitutions != "none") '' - ln -s ${pkgs.fontconfig-ultimate.confd}/etc/fonts/presets/${cfg.substitutions}/*.conf \ + ln -s ${pkgs.fontconfig-ultimate}/etc/fonts/presets/${cfg.substitutions}/*.conf \ $support_folder - ln -s ${pkgs.fontconfig-ultimate.confd}/etc/fonts/presets/${cfg.substitutions}/*.conf \ + ln -s ${pkgs.fontconfig-ultimate}/etc/fonts/presets/${cfg.substitutions}/*.conf \ $latest_folder ''} # fontconfig ultimate various configuration files - ln -s ${pkgs.fontconfig-ultimate.confd}/etc/fonts/conf.d/*.conf \ + ln -s ${pkgs.fontconfig-ultimate}/etc/fonts/conf.d/*.conf \ $support_folder - ln -s ${pkgs.fontconfig-ultimate.confd}/etc/fonts/conf.d/*.conf \ + ln -s ${pkgs.fontconfig-ultimate}/etc/fonts/conf.d/*.conf \ $latest_folder ''; @@ -153,9 +153,7 @@ in }; substitutions = mkOption { - type = types.str // { - check = flip elem ["none" "free" "combi" "ms"]; - }; + type = types.nullOr (types.enum ["free" "combi" "ms"]); default = "free"; description = '' Font substitutions to replace common Type 1 fonts with nicer @@ -166,35 +164,12 @@ in ''; }; - rendering = mkOption { - type = types.attrs; - default = pkgs.fontconfig-ultimate.rendering.ultimate; + preset = mkOption { + type = types.enum ["ultimate1" "ultimate2" "ultimate3" "ultimate4" "ultimate5" "osx" "windowsxp"]; + default = "ultimate3"; description = '' - FreeType rendering settings presets. The default is - pkgs.fontconfig-ultimate.rendering.ultimate. - The other available styles are: - ultimate-lighter, - ultimate-darker, - ultimate-lightest, - ultimate-darkest, - default (the original Infinality default), - osx, - ipad, - ubuntu, - linux, - winxplight, - win7light, - winxp, - win7, - vanilla, - classic, - nudge, - push, - shove, - sharpened, - infinality. Any of the presets may be - customized by editing the attributes. To disable, set this option - to the empty attribute set {}. + FreeType rendering settings preset. Any of the presets may be + customized by setting environment variables. ''; }; }; @@ -206,7 +181,7 @@ in config = mkIf (config.fonts.fontconfig.enable && cfg.enable) { fonts.fontconfig.confPackages = [ confPkg ]; - environment.variables = cfg.rendering; + environment.variables."INFINALITY_FT" = cfg.preset; }; diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index 3f8a770cbce..3caac6c4ee6 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -137,6 +137,9 @@ with lib; # Unity3D (mkRenamedOptionModule [ "programs" "unity3d" "enable" ] [ "security" "chromiumSuidSandbox" "enable" ]) + # fontconfig-ultimate + (mkRenamedOptionModule [ "fonts" "fontconfig" "ultimate" "rendering" ] [ "fonts" "fontconfig" "ultimate" "preset" ]) + # Options that are obsolete and have no replacement. (mkRemovedOptionModule [ "boot" "initrd" "luks" "enable" ]) (mkRemovedOptionModule [ "programs" "bash" "enable" ]) diff --git a/pkgs/development/libraries/fontconfig-ultimate/confd.nix b/pkgs/development/libraries/fontconfig-ultimate/confd.nix deleted file mode 100644 index 31679aa0806..00000000000 --- a/pkgs/development/libraries/fontconfig-ultimate/confd.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ stdenv, fetchFromGitHub }: - -let version = "2015-12-06"; in -stdenv.mkDerivation { - name = "fontconfig-ultimate-${version}"; - - src = fetchFromGitHub { - sha256 = "02a811szxkq4q088nxfpdzp6rv0brvgkdhwigk09qffygxd776g6"; - rev = version; - repo = "fontconfig-ultimate"; - owner = "bohoomil"; - }; - - phases = "$prePhases unpackPhase installPhase $postPhases"; - - installPhase = '' - mkdir -p $out/etc/fonts/conf.d - cp conf.d.infinality/*.conf $out/etc/fonts/conf.d - - # Base rendering settings will be determined by NixOS module - rm $out/etc/fonts/conf.d/10-base-rendering.conf - - # Options controlled by NixOS module - rm $out/etc/fonts/conf.d/35-repl-custom.conf - rm $out/etc/fonts/conf.d/38-repl-*.conf - rm $out/etc/fonts/conf.d/82-*.conf - rm $out/etc/fonts/conf.d/83-*.conf - - # Inclusion of local and user configs handled by global configuration - rm $out/etc/fonts/conf.d/29-local.conf - rm $out/etc/fonts/conf.d/28-user.conf - - cp fontconfig_patches/fonts-settings/*.conf $out/etc/fonts/conf.d - - # fix font priority issue https://github.com/bohoomil/fontconfig-ultimate/issues/173 - mv $out/etc/fonts/conf.d/{43,60}-wqy-zenhei-sharp.conf - - mkdir -p $out/etc/fonts/presets/{combi,free,ms} - cp fontconfig_patches/combi/*.conf $out/etc/fonts/presets/combi - cp fontconfig_patches/free/*.conf $out/etc/fonts/presets/free - cp fontconfig_patches/ms/*.conf $out/etc/fonts/presets/ms - ''; -} diff --git a/pkgs/development/libraries/fontconfig-ultimate/default.nix b/pkgs/development/libraries/fontconfig-ultimate/default.nix index aa799d850d7..efef59cad3b 100644 --- a/pkgs/development/libraries/fontconfig-ultimate/default.nix +++ b/pkgs/development/libraries/fontconfig-ultimate/default.nix @@ -1,6 +1,43 @@ -{ callPackage }: +{ stdenv, fetchFromGitHub }: -{ - confd = callPackage ./confd.nix {}; - rendering = callPackage ./rendering.nix {}; +let version = "2016-04-23"; in +stdenv.mkDerivation { + name = "fontconfig-ultimate-${version}"; + + src = fetchFromGitHub { + sha256 = "1rd2n60l8bamx84q3l91pd9a0wz9h7p6ajvx1dw22qn8rah4h498"; + rev = version; + repo = "fontconfig-ultimate"; + owner = "bohoomil"; + }; + + phases = "$prePhases unpackPhase installPhase $postPhases"; + + installPhase = '' + mkdir -p $out/etc/fonts/conf.d + cp conf.d.infinality/*.conf $out/etc/fonts/conf.d + + # Base rendering settings will be determined by NixOS module + rm $out/etc/fonts/conf.d/10-base-rendering.conf + + # Options controlled by NixOS module + rm $out/etc/fonts/conf.d/35-repl-custom.conf + rm $out/etc/fonts/conf.d/38-repl-*.conf + rm $out/etc/fonts/conf.d/82-*.conf + rm $out/etc/fonts/conf.d/83-*.conf + + # Inclusion of local and user configs handled by global configuration + rm $out/etc/fonts/conf.d/29-local.conf + rm $out/etc/fonts/conf.d/28-user.conf + + cp fontconfig_patches/fonts-settings/*.conf $out/etc/fonts/conf.d + + # fix font priority issue https://github.com/bohoomil/fontconfig-ultimate/issues/173 + mv $out/etc/fonts/conf.d/{43,60}-wqy-zenhei-sharp.conf + + mkdir -p $out/etc/fonts/presets/{combi,free,ms} + cp fontconfig_patches/combi/*.conf $out/etc/fonts/presets/combi + cp fontconfig_patches/free/*.conf $out/etc/fonts/presets/free + cp fontconfig_patches/ms/*.conf $out/etc/fonts/presets/ms + ''; } diff --git a/pkgs/development/libraries/fontconfig-ultimate/rendering.nix b/pkgs/development/libraries/fontconfig-ultimate/rendering.nix deleted file mode 100644 index b1de43b49b2..00000000000 --- a/pkgs/development/libraries/fontconfig-ultimate/rendering.nix +++ /dev/null @@ -1,212 +0,0 @@ -{}: - -rec { - default = { - INFINALITY_FT_FILTER_PARAMS="11 22 38 22 11"; - INFINALITY_FT_GRAYSCALE_FILTER_STRENGTH="0"; - INFINALITY_FT_FRINGE_FILTER_STRENGTH="0"; - INFINALITY_FT_AUTOHINT_HORIZONTAL_STEM_DARKEN_STRENGTH="10"; - INFINALITY_FT_AUTOHINT_VERTICAL_STEM_DARKEN_STRENGTH="25"; - INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="10"; - INFINALITY_FT_CHROMEOS_STYLE_SHARPENING_STRENGTH="0"; - INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="25"; - INFINALITY_FT_STEM_FITTING_STRENGTH="25"; - INFINALITY_FT_GAMMA_CORRECTION="0 100"; - INFINALITY_FT_BRIGHTNESS="0"; - INFINALITY_FT_CONTRAST="0"; - INFINALITY_FT_USE_VARIOUS_TWEAKS="true"; - INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="true"; - INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT="100"; - INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="40"; - INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="true"; - INFINALITY_FT_GLOBAL_EMBOLDEN_X_VALUE="0"; - INFINALITY_FT_GLOBAL_EMBOLDEN_Y_VALUE="0"; - INFINALITY_FT_BOLD_EMBOLDEN_X_VALUE="0"; - INFINALITY_FT_BOLD_EMBOLDEN_Y_VALUE="0"; - }; - - osx = default // { - INFINALITY_FT_FILTER_PARAMS="03 32 38 32 03"; - INFINALITY_FT_GRAYSCALE_FILTER_STRENGTH="25"; - INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0"; - INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="0"; - INFINALITY_FT_STEM_FITTING_STRENGTH="0"; - INFINALITY_FT_GAMMA_CORRECTION="1000 80"; - INFINALITY_FT_BRIGHTNESS="10"; - INFINALITY_FT_CONTRAST="20"; - INFINALITY_FT_USE_VARIOUS_TWEAKS="false"; - INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false"; - INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT="0"; - INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="0"; - INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="false"; - INFINALITY_FT_GLOBAL_EMBOLDEN_Y_VALUE="8"; - INFINALITY_FT_BOLD_EMBOLDEN_X_VALUE="16"; - }; - - ipad = default // { - INFINALITY_FT_FILTER_PARAMS="00 00 100 00 00"; - INFINALITY_FT_GRAYSCALE_FILTER_STRENGTH="100"; - INFINALITY_FT_AUTOHINT_HORIZONTAL_STEM_DARKEN_STRENGTH="0"; - INFINALITY_FT_AUTOHINT_VERTICAL_STEM_DARKEN_STRENGTH="0"; - INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0"; - INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="0"; - INFINALITY_FT_STEM_FITTING_STRENGTH="0"; - INFINALITY_FT_GAMMA_CORRECTION="1000 80"; - INFINALITY_FT_USE_VARIOUS_TWEAKS="false"; - INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false"; - INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT="0"; - INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="0"; - INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="false"; - }; - - ubuntu = default // { - INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0"; - INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="0"; - INFINALITY_FT_STEM_FITTING_STRENGTH="0"; - INFINALITY_FT_GAMMA_CORRECTION="1000 80"; - INFINALITY_FT_BRIGHTNESS="-10"; - INFINALITY_FT_CONTRAST="15"; - INFINALITY_FT_USE_VARIOUS_TWEAKS="false"; - INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false"; - INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT="0"; - INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="0"; - INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="false"; - }; - - linux = default // { - INFINALITY_FT_FILTER_PARAMS="06 25 44 25 06"; - INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0"; - INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="0"; - INFINALITY_FT_STEM_FITTING_STRENGTH="0"; - INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false"; - INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT="100"; - INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="false"; - }; - - winxplight = default // { - INFINALITY_FT_FILTER_PARAMS="06 25 44 25 06"; - INFINALITY_FT_FRINGE_FILTER_STRENGTH="100"; - INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="65"; - INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="15"; - INFINALITY_FT_STEM_FITTING_STRENGTH="15"; - INFINALITY_FT_GAMMA_CORRECTION="1000 120"; - INFINALITY_FT_BRIGHTNESS="20"; - INFINALITY_FT_CONTRAST="30"; - INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false"; - INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="30"; - }; - - win7light = default // { - INFINALITY_FT_FILTER_PARAMS="20 25 38 25 05"; - INFINALITY_FT_FRINGE_FILTER_STRENGTH="100"; - INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="100"; - INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="0"; - INFINALITY_FT_STEM_FITTING_STRENGTH="0"; - INFINALITY_FT_GAMMA_CORRECTION="1000 160"; - INFINALITY_FT_CONTRAST="20"; - INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false"; - INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="30"; - }; - - winxp = default // { - INFINALITY_FT_FILTER_PARAMS="06 25 44 25 06"; - INFINALITY_FT_FRINGE_FILTER_STRENGTH="100"; - INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="65"; - INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="15"; - INFINALITY_FT_STEM_FITTING_STRENGTH="15"; - INFINALITY_FT_GAMMA_CORRECTION="1000 120"; - INFINALITY_FT_BRIGHTNESS="10"; - INFINALITY_FT_CONTRAST="20"; - INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false"; - INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="30"; - }; - - win7 = default // { - INFINALITY_FT_FILTER_PARAMS="20 25 42 25 06"; - INFINALITY_FT_FRINGE_FILTER_STRENGTH="100"; - INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="65"; - INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="0"; - INFINALITY_FT_STEM_FITTING_STRENGTH="0"; - INFINALITY_FT_GAMMA_CORRECTION="1000 120"; - INFINALITY_FT_BRIGHTNESS="10"; - INFINALITY_FT_CONTRAST="20"; - INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false"; - INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="0"; - }; - - vanilla = default // { - INFINALITY_FT_FILTER_PARAMS="06 25 38 25 06"; - INFINALITY_FT_AUTOHINT_HORIZONTAL_STEM_DARKEN_STRENGTH="0"; - INFINALITY_FT_AUTOHINT_VERTICAL_STEM_DARKEN_STRENGTH="0"; - INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0"; - INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="0"; - INFINALITY_FT_STEM_FITTING_STRENGTH="0"; - INFINALITY_FT_USE_VARIOUS_TWEAKS="false"; - INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false"; - INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT="0"; - INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="0"; - INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="false"; - }; - - classic = default // { - INFINALITY_FT_FILTER_PARAMS="06 25 38 25 06"; - INFINALITY_FT_AUTOHINT_HORIZONTAL_STEM_DARKEN_STRENGTH="0"; - INFINALITY_FT_AUTOHINT_VERTICAL_STEM_DARKEN_STRENGTH="0"; - INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0"; - INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="0"; - INFINALITY_FT_STEM_FITTING_STRENGTH="0"; - INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="0"; - INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="false"; - }; - - nudge = default // { - INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0"; - INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="30"; - INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="false"; - }; - - push = default // { - INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0"; - INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="75"; - INFINALITY_FT_STEM_FITTING_STRENGTH="50"; - INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="30"; - }; - - infinality = default // { - INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="5"; - }; - - shove = default // { - INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0"; - INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="100"; - INFINALITY_FT_STEM_FITTING_STRENGTH="100"; - INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="0"; - }; - - sharpened = default // { - INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="65"; - }; - - ultimate = { - INFINALITY_FT_FILTER_PARAMS="08 24 36 24 08"; - INFINALITY_FT_FRINGE_FILTER_STRENGTH="50"; - INFINALITY_FT_USE_VARIOUS_TWEAKS="true"; - INFINALITY_FT_CHROMEOS_STYLE_SHARPENING_STRENGTH="20"; - }; - - ultimate-lighter = ultimate // { - INFINALITY_FT_FILTER_PARAMS="06 22 36 22 06"; - }; - - ultimate-lightest = ultimate // { - INFINALITY_FT_FILTER_PARAMS="04 22 38 22 04"; - }; - - ultimate-darker = ultimate // { - INFINALITY_FT_FILTER_PARAMS="10 25 37 25 10"; - }; - - ultimate-darkest = ultimate // { - INFINALITY_FT_FILTER_PARAMS="12 28 42 28 12"; - }; -} From c8658f9da8dfab593319fd73bf1809907fa1b315 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Fri, 19 Aug 2016 13:27:49 +0300 Subject: [PATCH 05/10] cairo: add infinality patches --- pkgs/development/libraries/cairo/default.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/cairo/default.nix b/pkgs/development/libraries/cairo/default.nix index f6f0a0d3af7..1f38f69eb0c 100644 --- a/pkgs/development/libraries/cairo/default.nix +++ b/pkgs/development/libraries/cairo/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, fetchpatch, pkgconfig, libiconv, libintlOrEmpty +{ stdenv, fetchurl, fetchFromGitHub, pkgconfig, libiconv, libintlOrEmpty , expat, zlib, libpng, pixman, fontconfig, freetype, xorg , gobjectSupport ? true, glib , xcbSupport ? true # no longer experimental since 1.12 @@ -19,6 +19,17 @@ stdenv.mkDerivation rec { sha256 = "0lmjlzmghmr27y615px9hkm552x7ap6pmq9mfbzr6smp8y2b6g31"; }; + infinality = fetchFromGitHub { + owner = "bohoomil"; + repo = "fontconfig-ultimate"; + rev = "730f5e77580677e86522c1f2119aa78803741759"; + sha256 = "1hbrdpm6xcczs2c2iid7by8h7dsd0jcf7an88s150njyqnjzxjg7"; + }; + + prePatch = '' + patches="$patches $(echo $infinality/*_cairo-iu/*.patch)" + ''; + outputs = [ "dev" "out" "docdev" ]; outputBin = "dev"; # very small From eb6f576ffd4a7ac1d8807dcca2229bff49dcd21d Mon Sep 17 00:00:00 2001 From: cmfwyp Date: Tue, 16 Aug 2016 02:35:59 -0400 Subject: [PATCH 06/10] fetchurl: update Savannah mirrors --- pkgs/build-support/fetchurl/mirrors.nix | 46 ++++++++++++++++++++----- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/pkgs/build-support/fetchurl/mirrors.nix b/pkgs/build-support/fetchurl/mirrors.nix index fec8918cb44..5ae5eb105e7 100644 --- a/pkgs/build-support/fetchurl/mirrors.nix +++ b/pkgs/build-support/fetchurl/mirrors.nix @@ -87,16 +87,44 @@ rec { ]; savannah = [ - ftp://mirror.csclub.uwaterloo.ca/nongnu/ - ftp://mirror.publicns.net/pub/nongnu/ - ftp://savannah.c3sl.ufpr.br/ - http://download.savannah.gnu.org/releases/ - http://ftp.cc.uoc.gr/mirrors/nongnu.org/ - http://ftp.twaren.net/Unix/NonGNU/ - http://mirror.csclub.uwaterloo.ca/nongnu/ - http://nongnu.askapache.com/ + # Mirrors from https://download-mirror.savannah.gnu.org/releases/00_MIRRORS.html + http://mirror.easyname.at/nongnu/ + http://mirror2.klaus-uwe.me/nongnu/ http://savannah.c3sl.ufpr.br/ - http://www.centervenus.com/mirrors/nongnu/ + http://mirror.csclub.uwaterloo.ca/nongnu/ + http://mirror.cedia.org.ec/nongnu/ + http://ftp.igh.cnrs.fr/pub/nongnu/ + http://mirror6.layerjet.com/nongnu + http://mirror.netcologne.de/savannah/ + http://ftp.cc.uoc.gr/mirrors/nongnu.org/ + http://nongnu.uib.no/ + http://mirrors.fe.up.pt/pub/nongnu/ + http://mirror.lihnidos.org/GNU/savannah/ + http://savannah.mirror.si/ + http://ftp.acc.umu.se/mirror/gnu.org/savannah/ + http://ftp.twaren.net/Unix/NonGNU/ + http://ftp.yzu.edu.tw/pub/nongnu/ + http://mirror.rackdc.com/savannah/ + http://savannah-nongnu-org.ip-connect.vn.ua/ + http://www.mirrorservice.org/sites/download.savannah.gnu.org/releases/ + http://savannah.spinellicreations.com/ + http://gnu.mirrors.pair.com/savannah/savannah/ + ftp://mirror.easyname.at/nongnu/ + ftp://mirror2.klaus-uwe.me/nongnu/ + ftp://savannah.c3sl.ufpr.br/savannah-nongnu/ + ftp://mirror.csclub.uwaterloo.ca/nongnu/ + ftp://mirror.cedia.org.ec/nongnu + ftp://ftp.igh.cnrs.fr/pub/nongnu/ + ftp://mirror6.layerjet.com/nongnu/ + ftp://mirror.netcologne.de/savannah/ + ftp://nongnu.uib.no/pub/nongnu/ + ftp://mirrors.fe.up.pt/pub/nongnu/ + ftp://savannah.mirror.si/savannah/ + ftp://ftp.twaren.net/Unix/NonGNU/ + ftp://ftp.yzu.edu.tw/pub/nongnu/ + ftp://savannah-nongnu-org.ip-connect.vn.ua/mirror/savannah.nongnu.org/ + ftp://ftp.mirrorservice.org/sites/download.savannah.gnu.org/releases/ + ftp://spinellicreations.com/gnu_dot_org_savannah_mirror/ ]; samba = [ From 574bba7f065f16a588e3ba21cb31df967e72a252 Mon Sep 17 00:00:00 2001 From: cmfwyp Date: Tue, 16 Aug 2016 02:36:40 -0400 Subject: [PATCH 07/10] freetype: remove -fno-strict-aliasing The strict aliasing violations this was meant to fix were already fixed in FreeType. --- pkgs/development/libraries/freetype/default.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/development/libraries/freetype/default.nix b/pkgs/development/libraries/freetype/default.nix index 0548d1433b7..39a71aea319 100644 --- a/pkgs/development/libraries/freetype/default.nix +++ b/pkgs/development/libraries/freetype/default.nix @@ -46,8 +46,6 @@ stdenv.mkDerivation rec { configureFlags = "--disable-static --bindir=$(dev)/bin"; - # from Gentoo, see https://bugzilla.redhat.com/show_bug.cgi?id=506840 - NIX_CFLAGS_COMPILE = "-fno-strict-aliasing"; # The asm for armel is written with the 'asm' keyword. CFLAGS = optionalString stdenv.isArm "-std=gnu99"; From 50c0011292fd44b5050c9829cb1860d0cd11cb89 Mon Sep 17 00:00:00 2001 From: cmfwyp Date: Tue, 16 Aug 2016 02:37:41 -0400 Subject: [PATCH 08/10] freetype: add a long description --- pkgs/development/libraries/freetype/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/freetype/default.nix b/pkgs/development/libraries/freetype/default.nix index 39a71aea319..6c4586a2483 100644 --- a/pkgs/development/libraries/freetype/default.nix +++ b/pkgs/development/libraries/freetype/default.nix @@ -64,7 +64,14 @@ stdenv.mkDerivation rec { meta = with stdenv.lib; { description = "A font rendering engine"; - homepage = http://www.freetype.org/; + longDescription = '' + FreeType is a portable and efficient library for rendering fonts. It + supports TrueType, Type 1, CFF fonts, and WOFF, PCF, FNT, BDF and PFR + fonts. It has a bytecode interpreter and has an automatic hinter called + autofit which can be used instead of hinting instructions included in + fonts. + ''; + homepage = https://www.freetype.org/; license = licenses.gpl2Plus; # or the FreeType License (BSD + advertising clause) #ToDo: encumbered = useEncumberedCode; platforms = platforms.all; From 1c7114da69a257b01f6ca7827ae58e788844c114 Mon Sep 17 00:00:00 2001 From: cmfwyp Date: Tue, 16 Aug 2016 02:38:07 -0400 Subject: [PATCH 09/10] freetype: 2.6.2 -> 2.6.5 The fontconfig-ultimate patches are unmaintained. Since they were not updated for newer FreeType versions, this removes them and disables fontconfig-ultimate by default. --- .../config/fonts/fontconfig-ultimate.nix | 2 +- pkgs/development/compilers/openjdk/8.nix | 2 +- .../libraries/freetype/default.nix | 38 +++++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/nixos/modules/config/fonts/fontconfig-ultimate.nix b/nixos/modules/config/fonts/fontconfig-ultimate.nix index a3f52fbd919..56fec568441 100644 --- a/nixos/modules/config/fonts/fontconfig-ultimate.nix +++ b/nixos/modules/config/fonts/fontconfig-ultimate.nix @@ -104,7 +104,7 @@ in ultimate = { enable = mkOption { type = types.bool; - default = true; + default = false; description = '' Enable fontconfig-ultimate settings (formerly known as Infinality). Besides the customizable settings in this NixOS diff --git a/pkgs/development/compilers/openjdk/8.nix b/pkgs/development/compilers/openjdk/8.nix index c42b39ce91f..3653e75856d 100644 --- a/pkgs/development/compilers/openjdk/8.nix +++ b/pkgs/development/compilers/openjdk/8.nix @@ -2,7 +2,7 @@ , alsaLib, bootjdk, cacert, perl, liberation_ttf, fontconfig, zlib , setJavaClassPath , minimal ? false -, enableInfinality ? true # font rendering patch +, enableInfinality ? false # font rendering patch }: let diff --git a/pkgs/development/libraries/freetype/default.nix b/pkgs/development/libraries/freetype/default.nix index 6c4586a2483..316d8b5db23 100644 --- a/pkgs/development/libraries/freetype/default.nix +++ b/pkgs/development/libraries/freetype/default.nix @@ -8,33 +8,33 @@ }: let - version = "2.6.2"; - - # Don't use fetchpatch. It mangles them. That's an hour I'll never get back. - fetchbohoomil = name: sha256: fetchurl { - url = https://raw.githubusercontent.com/bohoomil/fontconfig-ultimate/254b688f96d4a37f78fb594303a43160fc15c7cd/freetype/ + name; - inherit sha256; - }; + version = "2.6.5"; in with { inherit (stdenv.lib) optional optionals optionalString; }; stdenv.mkDerivation rec { name = "freetype-${version}"; src = fetchurl { - url = "mirror://sourceforge/freetype/${name}.tar.bz2"; - sha256 = "14mqrfgl18q2by1yzv6vcxi97zjy4kppcgsqf312mhfwgkpvvxms"; + url = "mirror://savannah/freetype/${name}.tar.bz2"; + sha256 = "1w5c87s4rpx9af5b3mk5cjd1yny3c4dq5p9iv3ixb3vr00a6w2p2"; }; - patches = [] - # mingw: these patches use `strcasestr` which isn't available on windows - ++ optionals (useEncumberedCode && stdenv.cross.libc or null != "msvcrt" ) [ - (fetchbohoomil "01-freetype-2.6.2-enable-valid.patch" - "1szq0zha7n41f4pq179wgfkam034mp2xn0xc36sdl5sjp9s9hv08") - (fetchbohoomil "02-upstream-2015.12.05.patch" - "0781r9n35kpn8db8nma0l47cpkzh0hbp84ziii5sald90dnrqdj4") - (fetchbohoomil "03-infinality-2.6.2-2015.12.05.patch" - "0wcjf9hiymplgqm3szla633i417pb57vpzzs2dyl1dnmcxgqa2y8") - ]; + patches = [ + # Patch for validation of OpenType and GX/AAT tables. + (fetchurl { + name = "freetype-2.2.1-enable-valid.patch"; + url = "http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/plain/freetype-2.2.1-enable-valid.patch?id=9a81147af83b1166a5f301e379f85927cc610990"; + sha256 = "0zkgqhws2s0j8ywksclf391iijhidb1a406zszd7xbdjn28kmj2l"; + }) + ] ++ optionals (useEncumberedCode) [ + # Patch to enable subpixel rendering. + # See https://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html. + (fetchurl { + name = "freetype-2.3.0-enable-spr.patch"; + url = http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/plain/freetype-2.3.0-enable-spr.patch?id=9a81147af83b1166a5f301e379f85927cc610990; + sha256 = "13ni9n5q3nla38wjmxd4f8cy29gp62kjx2l6y6nqhdyiqp8fz8nd"; + }) + ]; outputs = [ "dev" "out" ]; From f961fc7dd13a724f332482234e126e4526bc2091 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Sat, 20 Aug 2016 02:01:34 +0300 Subject: [PATCH 10/10] freetype: re-add infinality patches archfan has updated those patches for the new version. --- .../config/fonts/fontconfig-ultimate.nix | 2 +- pkgs/development/compilers/openjdk/8.nix | 2 +- .../libraries/freetype/default.nix | 21 ++++++++++++++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/nixos/modules/config/fonts/fontconfig-ultimate.nix b/nixos/modules/config/fonts/fontconfig-ultimate.nix index 56fec568441..a3f52fbd919 100644 --- a/nixos/modules/config/fonts/fontconfig-ultimate.nix +++ b/nixos/modules/config/fonts/fontconfig-ultimate.nix @@ -104,7 +104,7 @@ in ultimate = { enable = mkOption { type = types.bool; - default = false; + default = true; description = '' Enable fontconfig-ultimate settings (formerly known as Infinality). Besides the customizable settings in this NixOS diff --git a/pkgs/development/compilers/openjdk/8.nix b/pkgs/development/compilers/openjdk/8.nix index 3653e75856d..c42b39ce91f 100644 --- a/pkgs/development/compilers/openjdk/8.nix +++ b/pkgs/development/compilers/openjdk/8.nix @@ -2,7 +2,7 @@ , alsaLib, bootjdk, cacert, perl, liberation_ttf, fontconfig, zlib , setJavaClassPath , minimal ? false -, enableInfinality ? false # font rendering patch +, enableInfinality ? true # font rendering patch }: let diff --git a/pkgs/development/libraries/freetype/default.nix b/pkgs/development/libraries/freetype/default.nix index 316d8b5db23..8ef51172f94 100644 --- a/pkgs/development/libraries/freetype/default.nix +++ b/pkgs/development/libraries/freetype/default.nix @@ -1,14 +1,25 @@ -{ stdenv, fetchurl, fetchpatch, pkgconfig, which, zlib, bzip2, libpng, gnumake +{ stdenv, fetchurl, fetchFromGitHub, pkgconfig, which, zlib, bzip2, libpng, gnumake , glib /* passthru only */ # FreeType supports sub-pixel rendering. This is patented by # Microsoft, so it is disabled by default. This option allows it to # be enabled. See http://www.freetype.org/patents.html. , useEncumberedCode ? true +, useInfinality ? true }: +assert useInfinality -> useEncumberedCode; + let version = "2.6.5"; + + infinality = fetchFromGitHub { + owner = "archfan"; + repo = "infinality_bundle"; + rev = "5c0949a477bf43d2ac4e57b4fc39bcc3331002ee"; + sha256 = "17389aqm6rlxl4b5mv1fx4b22x2v2n60hfhixfxqxpd8ialsdi6l"; + }; + in with { inherit (stdenv.lib) optional optionals optionalString; }; stdenv.mkDerivation rec { @@ -26,7 +37,7 @@ stdenv.mkDerivation rec { url = "http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/plain/freetype-2.2.1-enable-valid.patch?id=9a81147af83b1166a5f301e379f85927cc610990"; sha256 = "0zkgqhws2s0j8ywksclf391iijhidb1a406zszd7xbdjn28kmj2l"; }) - ] ++ optionals (useEncumberedCode) [ + ] ++ optionals (!useInfinality && useEncumberedCode) [ # Patch to enable subpixel rendering. # See https://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html. (fetchurl { @@ -36,6 +47,10 @@ stdenv.mkDerivation rec { }) ]; + prePatch = optionalString useInfinality '' + patches="$patches $(ls ${infinality}/*_freetype2-iu/*-infinality-*.patch)" + ''; + outputs = [ "dev" "out" ]; propagatedBuildInputs = [ zlib bzip2 libpng ]; # needed when linking against freetype @@ -44,7 +59,7 @@ stdenv.mkDerivation rec { # FreeType requires GNU Make, which is not part of stdenv on FreeBSD. ++ optional (!stdenv.isLinux) gnumake; - configureFlags = "--disable-static --bindir=$(dev)/bin"; + configureFlags = [ "--disable-static" "--bindir=$(dev)/bin" ]; # The asm for armel is written with the 'asm' keyword. CFLAGS = optionalString stdenv.isArm "-std=gnu99";