···1{
0002 runCommand,
3- lib,
4- fontconfig,
000005 fontDirectories,
6}:
78runCommand "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
3100032 mkdir -p $out
33- fc-cache -sv
3435 # 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}:
1516runCommand "fc-cache"
17 {
018 preferLocalBuild = true;
19 allowSubstitutes = false;
20 passAsFile = [ "fontDirs" ];
···36 cat "$fontDirsPath" >> fonts.conf
37 echo "</fontconfig>" >> fonts.conf
3839+ # 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
4445 # This is not a cache dir in the normal sense -- it won't be automatically
46 # recreated.