diff --git a/pkgs/development/libraries/fontconfig/make-fonts-cache.nix b/pkgs/development/libraries/fontconfig/make-fonts-cache.nix index a1ac7d1b9859..9054cf6756ba 100644 --- a/pkgs/development/libraries/fontconfig/make-fonts-cache.nix +++ b/pkgs/development/libraries/fontconfig/make-fonts-cache.nix @@ -1,13 +1,20 @@ { - runCommand, - lib, + buildPackages, fontconfig, + lib, + runCommand, + stdenv, +}: +let + fontconfig' = fontconfig; +in +{ + fontconfig ? fontconfig', fontDirectories, }: runCommand "fc-cache" { - nativeBuildInputs = [ fontconfig.bin ]; preferLocalBuild = true; allowSubstitutes = false; passAsFile = [ "fontDirs" ]; @@ -29,8 +36,11 @@ runCommand "fc-cache" cat "$fontDirsPath" >> fonts.conf echo "" >> fonts.conf + # N.B.: fc-cache keys its cache entries by architecture. + # We must invoke the host `fc-cache` (not the build fontconfig) if we want + # the cache to be usable by the host. mkdir -p $out - fc-cache -sv + ${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe' fontconfig "fc-cache"} -sv # This is not a cache dir in the normal sense -- it won't be automatically # recreated. diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index db392a2b84ea..9d8ccbae637d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8764,10 +8764,7 @@ with pkgs; makeFontsConf = callPackage ../development/libraries/fontconfig/make-fonts-conf.nix { }; - makeFontsCache = let fontconfig_ = fontconfig; in {fontconfig ? fontconfig_, fontDirectories}: - callPackage ../development/libraries/fontconfig/make-fonts-cache.nix { - inherit fontconfig fontDirectories; - }; + makeFontsCache = callPackage ../development/libraries/fontconfig/make-fonts-cache.nix { }; freenect = callPackage ../development/libraries/freenect { inherit (darwin.apple_sdk.frameworks) Cocoa GLUT;