Merge pull request #95681 from flokli/fontconfig-penultimate-remove

nixos/fonts: remove fontconfig-penultimate

authored by

Silvan Mosberger and committed by
GitHub
c6aa9e4a 6f4a508a

+6 -320
-292
nixos/modules/config/fonts/fontconfig-penultimate.nix
··· 1 - { config, pkgs, lib, ... }: 2 - 3 - with lib; 4 - 5 - let 6 - cfg = config.fonts.fontconfig; 7 - 8 - fcBool = x: "<bool>" + (boolToString x) + "</bool>"; 9 - 10 - # back-supported fontconfig version and package 11 - # version is used for font cache generation 12 - supportVersion = "210"; 13 - supportPkg = pkgs."fontconfig_${supportVersion}"; 14 - 15 - # latest fontconfig version and package 16 - # version is used for configuration folder name, /etc/fonts/VERSION/ 17 - # note: format differs from supportVersion and can not be used with makeCacheConf 18 - latestVersion = pkgs.fontconfig.configVersion; 19 - latestPkg = pkgs.fontconfig; 20 - 21 - # supported version fonts.conf 22 - supportFontsConf = pkgs.makeFontsConf { fontconfig = supportPkg; fontDirectories = config.fonts.fonts; }; 23 - 24 - # configuration file to read fontconfig cache 25 - # version dependent 26 - # priority 0 27 - cacheConfSupport = makeCacheConf { version = supportVersion; }; 28 - cacheConfLatest = makeCacheConf {}; 29 - 30 - # generate the font cache setting file for a fontconfig version 31 - # use latest when no version is passed 32 - makeCacheConf = { version ? null }: 33 - let 34 - fcPackage = if version == null 35 - then "fontconfig" 36 - else "fontconfig_${version}"; 37 - makeCache = fontconfig: pkgs.makeFontsCache { inherit fontconfig; fontDirectories = config.fonts.fonts; }; 38 - cache = makeCache pkgs.${fcPackage}; 39 - cache32 = makeCache pkgs.pkgsi686Linux.${fcPackage}; 40 - in 41 - pkgs.writeText "fc-00-nixos-cache.conf" '' 42 - <?xml version='1.0'?> 43 - <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> 44 - <fontconfig> 45 - <!-- Font directories --> 46 - ${concatStringsSep "\n" (map (font: "<dir>${font}</dir>") config.fonts.fonts)} 47 - <!-- Pre-generated font caches --> 48 - <cachedir>${cache}</cachedir> 49 - ${optionalString (pkgs.stdenv.isx86_64 && cfg.cache32Bit) '' 50 - <cachedir>${cache32}</cachedir> 51 - ''} 52 - </fontconfig> 53 - ''; 54 - 55 - # local configuration file 56 - localConf = pkgs.writeText "fc-local.conf" cfg.localConf; 57 - 58 - # rendering settings configuration files 59 - # priority 10 60 - hintingConf = pkgs.writeText "fc-10-hinting.conf" '' 61 - <?xml version='1.0'?> 62 - <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> 63 - <fontconfig> 64 - 65 - <!-- Default rendering settings --> 66 - <match target="pattern"> 67 - <edit mode="append" name="hinting"> 68 - ${fcBool cfg.hinting.enable} 69 - </edit> 70 - <edit mode="append" name="autohint"> 71 - ${fcBool cfg.hinting.autohint} 72 - </edit> 73 - <edit mode="append" name="hintstyle"> 74 - <const>hintslight</const> 75 - </edit> 76 - </match> 77 - 78 - </fontconfig> 79 - ''; 80 - 81 - antialiasConf = pkgs.writeText "fc-10-antialias.conf" '' 82 - <?xml version='1.0'?> 83 - <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> 84 - <fontconfig> 85 - 86 - <!-- Default rendering settings --> 87 - <match target="pattern"> 88 - <edit mode="append" name="antialias"> 89 - ${fcBool cfg.antialias} 90 - </edit> 91 - </match> 92 - 93 - </fontconfig> 94 - ''; 95 - 96 - subpixelConf = pkgs.writeText "fc-10-subpixel.conf" '' 97 - <?xml version='1.0'?> 98 - <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> 99 - <fontconfig> 100 - 101 - <!-- Default rendering settings --> 102 - <match target="pattern"> 103 - <edit mode="append" name="rgba"> 104 - <const>${cfg.subpixel.rgba}</const> 105 - </edit> 106 - <edit mode="append" name="lcdfilter"> 107 - <const>lcd${cfg.subpixel.lcdfilter}</const> 108 - </edit> 109 - </match> 110 - 111 - </fontconfig> 112 - ''; 113 - 114 - dpiConf = pkgs.writeText "fc-11-dpi.conf" '' 115 - <?xml version='1.0'?> 116 - <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> 117 - <fontconfig> 118 - 119 - <match target="pattern"> 120 - <edit name="dpi" mode="assign"> 121 - <double>${toString cfg.dpi}</double> 122 - </edit> 123 - </match> 124 - 125 - </fontconfig> 126 - ''; 127 - 128 - # default fonts configuration file 129 - # priority 52 130 - defaultFontsConf = 131 - let genDefault = fonts: name: 132 - optionalString (fonts != []) '' 133 - <alias> 134 - <family>${name}</family> 135 - <prefer> 136 - ${concatStringsSep "" 137 - (map (font: '' 138 - <family>${font}</family> 139 - '') fonts)} 140 - </prefer> 141 - </alias> 142 - ''; 143 - in 144 - pkgs.writeText "fc-52-nixos-default-fonts.conf" '' 145 - <?xml version='1.0'?> 146 - <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> 147 - <fontconfig> 148 - 149 - <!-- Default fonts --> 150 - ${genDefault cfg.defaultFonts.sansSerif "sans-serif"} 151 - 152 - ${genDefault cfg.defaultFonts.serif "serif"} 153 - 154 - ${genDefault cfg.defaultFonts.monospace "monospace"} 155 - 156 - </fontconfig> 157 - ''; 158 - 159 - # reject Type 1 fonts 160 - # priority 53 161 - rejectType1 = pkgs.writeText "fc-53-nixos-reject-type1.conf" '' 162 - <?xml version="1.0"?> 163 - <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> 164 - <fontconfig> 165 - 166 - <!-- Reject Type 1 fonts --> 167 - <selectfont> 168 - <rejectfont> 169 - <pattern> 170 - <patelt name="fontformat"><string>Type 1</string></patelt> 171 - </pattern> 172 - </rejectfont> 173 - </selectfont> 174 - 175 - </fontconfig> 176 - ''; 177 - 178 - # The configuration to be included in /etc/font/ 179 - penultimateConf = pkgs.runCommand "fontconfig-penultimate-conf" { 180 - preferLocalBuild = true; 181 - } '' 182 - support_folder=$out/etc/fonts/conf.d 183 - latest_folder=$out/etc/fonts/${latestVersion}/conf.d 184 - 185 - mkdir -p $support_folder 186 - mkdir -p $latest_folder 187 - 188 - # fonts.conf 189 - ln -s ${supportFontsConf} $support_folder/../fonts.conf 190 - ln -s ${latestPkg.out}/etc/fonts/fonts.conf \ 191 - $latest_folder/../fonts.conf 192 - 193 - # fontconfig-penultimate various configuration files 194 - ln -s ${pkgs.fontconfig-penultimate}/etc/fonts/conf.d/*.conf \ 195 - $support_folder 196 - ln -s ${pkgs.fontconfig-penultimate}/etc/fonts/conf.d/*.conf \ 197 - $latest_folder 198 - 199 - ln -s ${cacheConfSupport} $support_folder/00-nixos-cache.conf 200 - ln -s ${cacheConfLatest} $latest_folder/00-nixos-cache.conf 201 - 202 - rm $support_folder/10-antialias.conf $latest_folder/10-antialias.conf 203 - ln -s ${antialiasConf} $support_folder/10-antialias.conf 204 - ln -s ${antialiasConf} $latest_folder/10-antialias.conf 205 - 206 - rm $support_folder/10-hinting.conf $latest_folder/10-hinting.conf 207 - ln -s ${hintingConf} $support_folder/10-hinting.conf 208 - ln -s ${hintingConf} $latest_folder/10-hinting.conf 209 - 210 - ${optionalString cfg.useEmbeddedBitmaps '' 211 - rm $support_folder/10-no-embedded-bitmaps.conf 212 - rm $latest_folder/10-no-embedded-bitmaps.conf 213 - ''} 214 - 215 - rm $support_folder/10-subpixel.conf $latest_folder/10-subpixel.conf 216 - ln -s ${subpixelConf} $support_folder/10-subpixel.conf 217 - ln -s ${subpixelConf} $latest_folder/10-subpixel.conf 218 - 219 - ${optionalString (cfg.dpi != 0) '' 220 - ln -s ${dpiConf} $support_folder/11-dpi.conf 221 - ln -s ${dpiConf} $latest_folder/11-dpi.conf 222 - ''} 223 - 224 - # 50-user.conf 225 - ${optionalString (!cfg.includeUserConf) '' 226 - rm $support_folder/50-user.conf 227 - rm $latest_folder/50-user.conf 228 - ''} 229 - 230 - # 51-local.conf 231 - rm $latest_folder/51-local.conf 232 - substitute \ 233 - ${pkgs.fontconfig-penultimate}/etc/fonts/conf.d/51-local.conf \ 234 - $latest_folder/51-local.conf \ 235 - --replace local.conf /etc/fonts/${latestVersion}/local.conf 236 - 237 - # local.conf (indirect priority 51) 238 - ${optionalString (cfg.localConf != "") '' 239 - ln -s ${localConf} $support_folder/../local.conf 240 - ln -s ${localConf} $latest_folder/../local.conf 241 - ''} 242 - 243 - # 52-nixos-default-fonts.conf 244 - ln -s ${defaultFontsConf} $support_folder/52-nixos-default-fonts.conf 245 - ln -s ${defaultFontsConf} $latest_folder/52-nixos-default-fonts.conf 246 - 247 - # 53-no-bitmaps.conf 248 - ${optionalString cfg.allowBitmaps '' 249 - rm $support_folder/53-no-bitmaps.conf 250 - rm $latest_folder/53-no-bitmaps.conf 251 - ''} 252 - 253 - ${optionalString (!cfg.allowType1) '' 254 - # 53-nixos-reject-type1.conf 255 - ln -s ${rejectType1} $support_folder/53-nixos-reject-type1.conf 256 - ln -s ${rejectType1} $latest_folder/53-nixos-reject-type1.conf 257 - ''} 258 - ''; 259 - 260 - in 261 - { 262 - 263 - options = { 264 - 265 - fonts = { 266 - 267 - fontconfig = { 268 - 269 - penultimate = { 270 - enable = mkOption { 271 - type = types.bool; 272 - default = false; 273 - description = '' 274 - Enable fontconfig-penultimate settings to supplement the 275 - NixOS defaults by providing per-font rendering defaults and 276 - metric aliases. 277 - ''; 278 - }; 279 - }; 280 - 281 - }; 282 - }; 283 - 284 - }; 285 - 286 - config = mkIf (config.fonts.fontconfig.enable && config.fonts.fontconfig.penultimate.enable) { 287 - 288 - fonts.fontconfig.confPackages = [ penultimateConf ]; 289 - 290 - }; 291 - 292 - }
+1 -1
nixos/modules/config/fonts/fontconfig.nix
··· 457 457 environment.systemPackages = [ pkgs.fontconfig ]; 458 458 environment.etc.fonts.source = "${fontconfigEtc}/etc/fonts/"; 459 459 }) 460 - (mkIf (cfg.enable && !cfg.penultimate.enable) { 460 + (mkIf cfg.enable { 461 461 fonts.fontconfig.confPackages = [ confPkg ]; 462 462 }) 463 463 ];
-1
nixos/modules/module-list.nix
··· 1 1 [ 2 2 ./config/debug-info.nix 3 3 ./config/fonts/fontconfig.nix 4 - ./config/fonts/fontconfig-penultimate.nix 5 4 ./config/fonts/fontdir.nix 6 5 ./config/fonts/fonts.nix 7 6 ./config/fonts/ghostscript.nix
+1
nixos/modules/rename.nix
··· 17 17 (mkAliasOptionModule [ "environment" "checkConfigurationOptions" ] [ "_module" "check" ]) 18 18 19 19 # Completely removed modules 20 + (mkRemovedOptionModule [ "fonts" "fontconfig" "penultimate" ] "The corresponding package has removed from nixpkgs.") 20 21 (mkRemovedOptionModule [ "services" "chronos" ] "The corresponding package was removed from nixpkgs.") 21 22 (mkRemovedOptionModule [ "services" "firefox" "syncserver" "user" ] "") 22 23 (mkRemovedOptionModule [ "services" "firefox" "syncserver" "group" ] "")
-24
pkgs/data/fonts/fontconfig-penultimate/default.nix
··· 1 - { lib, fetchzip 2 - , version ? "0.3.5" 3 - , sha256 ? "1gfgl7qimp76q4z0nv55vv57yfs4kscdr329np701k0xnhncwvrk" 4 - }: 5 - 6 - fetchzip { 7 - name = "fontconfig-penultimate-${version}"; 8 - 9 - url = "https://github.com/ttuegel/fontconfig-penultimate/archive/${version}.zip"; 10 - inherit sha256; 11 - 12 - postFetch = '' 13 - mkdir -p $out/etc/fonts/conf.d 14 - unzip -j $downloadedFile \*.conf -d $out/etc/fonts/conf.d 15 - ''; 16 - 17 - meta = with lib; { 18 - homepage = "https://github.com/ttuegel/fontconfig-penultimate"; 19 - description = "Sensible defaults for Fontconfig"; 20 - license = licenses.asl20; 21 - maintainers = [ maintainers.ttuegel ]; 22 - platforms = platforms.all; 23 - }; 24 - }
+4
pkgs/top-level/aliases.nix
··· 140 140 fontconfig-ultimate has been removed. The repository has been archived upstream and activity has ceased for several years. 141 141 https://github.com/bohoomil/fontconfig-ultimate/issues/171. 142 142 ''; 143 + fontconfig-penultimate = throw '' 144 + fontconfig-penultimate has been removed. 145 + It was a fork of the abandoned fontconfig-ultimate. 146 + ''; 143 147 # 2020-07-21 144 148 fontconfig_210 = throw '' 145 149 fontconfig 2.10.x hasn't had a release in years, is vulnerable to CVE-2016-5384
-2
pkgs/top-level/all-packages.nix
··· 12105 12105 12106 12106 fontconfig = callPackage ../development/libraries/fontconfig { }; 12107 12107 12108 - fontconfig-penultimate = callPackage ../data/fonts/fontconfig-penultimate {}; 12109 - 12110 12108 folly = callPackage ../development/libraries/folly { }; 12111 12109 12112 12110 folks = callPackage ../development/libraries/folks { };