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