nixos/fonts: ship fontconfig caches even for cross-compiled hosts (#391305)

authored by K900 and committed by GitHub b64ec194 0402be64

+16 -9
+1 -1
nixos/modules/config/fonts/fontconfig.nix
··· 58 <fontconfig> 59 <!-- Font directories --> 60 ${lib.concatStringsSep "\n" (map (font: "<dir>${font}</dir>") config.fonts.packages)} 61 - ${lib.optionalString (pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform) '' 62 <!-- Pre-generated font caches --> 63 <cachedir>${cache}</cachedir> 64 ${lib.optionalString (pkgs.stdenv.hostPlatform.isx86_64 && cfg.cache32Bit) ''
··· 58 <fontconfig> 59 <!-- Font directories --> 60 ${lib.concatStringsSep "\n" (map (font: "<dir>${font}</dir>") config.fonts.packages)} 61 + ${lib.optionalString (pkgs.stdenv.hostPlatform.emulatorAvailable pkgs.buildPackages) '' 62 <!-- Pre-generated font caches --> 63 <cachedir>${cache}</cachedir> 64 ${lib.optionalString (pkgs.stdenv.hostPlatform.isx86_64 && cfg.cache32Bit) ''
+14 -4
pkgs/development/libraries/fontconfig/make-fonts-cache.nix
··· 1 { 2 runCommand, 3 - lib, 4 - fontconfig, 5 fontDirectories, 6 }: 7 8 runCommand "fc-cache" 9 { 10 - nativeBuildInputs = [ fontconfig.bin ]; 11 preferLocalBuild = true; 12 allowSubstitutes = false; 13 passAsFile = [ "fontDirs" ]; ··· 29 cat "$fontDirsPath" >> fonts.conf 30 echo "</fontconfig>" >> fonts.conf 31 32 mkdir -p $out 33 - fc-cache -sv 34 35 # This is not a cache dir in the normal sense -- it won't be automatically 36 # recreated.
··· 1 { 2 + buildPackages, 3 + fontconfig, 4 + lib, 5 runCommand, 6 + stdenv, 7 + }: 8 + let 9 + fontconfig' = fontconfig; 10 + in 11 + { 12 + fontconfig ? fontconfig', 13 fontDirectories, 14 }: 15 16 runCommand "fc-cache" 17 { 18 preferLocalBuild = true; 19 allowSubstitutes = false; 20 passAsFile = [ "fontDirs" ]; ··· 36 cat "$fontDirsPath" >> fonts.conf 37 echo "</fontconfig>" >> fonts.conf 38 39 + # N.B.: fc-cache keys its cache entries by architecture. 40 + # We must invoke the host `fc-cache` (not the build fontconfig) if we want 41 + # the cache to be usable by the host. 42 mkdir -p $out 43 + ${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe' fontconfig "fc-cache"} -sv 44 45 # This is not a cache dir in the normal sense -- it won't be automatically 46 # recreated.
+1 -4
pkgs/top-level/all-packages.nix
··· 8742 8743 makeFontsConf = callPackage ../development/libraries/fontconfig/make-fonts-conf.nix { }; 8744 8745 - makeFontsCache = let fontconfig_ = fontconfig; in {fontconfig ? fontconfig_, fontDirectories}: 8746 - callPackage ../development/libraries/fontconfig/make-fonts-cache.nix { 8747 - inherit fontconfig fontDirectories; 8748 - }; 8749 8750 freenect = callPackage ../development/libraries/freenect { 8751 inherit (darwin.apple_sdk.frameworks) Cocoa GLUT;
··· 8742 8743 makeFontsConf = callPackage ../development/libraries/fontconfig/make-fonts-conf.nix { }; 8744 8745 + makeFontsCache = callPackage ../development/libraries/fontconfig/make-fonts-cache.nix { }; 8746 8747 freenect = callPackage ../development/libraries/freenect { 8748 inherit (darwin.apple_sdk.frameworks) Cocoa GLUT;