mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-01 18:12:46 +00:00
8ea7a302bd
A CACHEDIR.TAG file indicates that the contents can be automatically re-generated. This is not really true for Nix store paths. (Well _Nix_ can recreate them, but that's different.) I noticed this issue as I was restoring full system backup that "for some reason" always missed /nix/store/*-fc-cache (found by `nix-store --verify --repair`). Turns out I was excluding caches from my backup...
32 lines
824 B
Nix
32 lines
824 B
Nix
{ runCommand, lib, writeText, fontconfig, fontDirectories }:
|
|
|
|
runCommand "fc-cache"
|
|
rec {
|
|
buildInputs = [ fontconfig.bin ];
|
|
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 "$out/CACHEDIR.TAG"
|
|
''
|