forked from mirrors/nixpkgs
a6a29e07bc
Today I couldn't rebuild because of: [...] /nix/store/lxkrsrlqplz2n75hvpq6vr0gam0gfgrl-font-cursor-misc-1.0.3/lib/X11/fonts/misc: skipping, existing cache is valid: 1 fonts, 0 dirs /var/cache/fontconfig: cleaning cache directory /nix/store/xq3c44ha15pfa5a9mv1z9mni3cfghsna-fc-cache: cleaning cache directory fc-cache: succeeded rm: cannot remove '/nix/store/xq3c44ha15pfa5a9mv1z9mni3cfghsna-fc-cache/CACHEDIR.TAG': No such file or directory builder for '/nix/store/zxfmil40n79vhn5hb4flqc76j99a3l7b-fc-cache.drv' failed with exit code 1
33 lines
845 B
Nix
33 lines
845 B
Nix
{ runCommand, lib, fontconfig, fontDirectories }:
|
|
|
|
runCommand "fc-cache"
|
|
rec {
|
|
buildInputs = [ fontconfig.bin ];
|
|
preferLocalBuild = true;
|
|
passAsFile = [ "fontDirs" ];
|
|
fontDirs = ''
|
|
<!-- Font directories -->
|
|
${lib.concatStringsSep "\n" (map (font: "<dir>${font}</dir>") fontDirectories)}
|
|
'';
|
|
}
|
|
''
|
|
export FONTCONFIG_FILE=$(pwd)/fonts.conf
|
|
|
|
cat > fonts.conf << EOF
|
|
<?xml version='1.0'?>
|
|
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
|
<fontconfig>
|
|
<include>${fontconfig.out}/etc/fonts/fonts.conf</include>
|
|
<cachedir>$out</cachedir>
|
|
EOF
|
|
cat "$fontDirsPath" >> fonts.conf
|
|
echo "</fontconfig>" >> fonts.conf
|
|
|
|
mkdir -p $out
|
|
fc-cache -sv
|
|
|
|
# This is not a cache dir in the normal sense -- it won't be automatically
|
|
# recreated.
|
|
rm -f "$out/CACHEDIR.TAG"
|
|
''
|