fontconfig service: add pre-generated fonts caches
This commit is contained in:
parent
893af77556
commit
39b5bc3b2f
@ -129,6 +129,14 @@ with lib;
|
||||
|
||||
};
|
||||
|
||||
cache32Bit = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Generate system fonts cache for 32-bit applications.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
@ -231,12 +239,19 @@ with lib;
|
||||
"${pkgs.fontconfig}/etc/fonts/fonts.conf";
|
||||
|
||||
environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/00-nixos.conf".text =
|
||||
''
|
||||
let
|
||||
cache = fontconfig: pkgs.makeFontsCache { inherit fontconfig; fontDirectories = config.fonts.fonts; };
|
||||
in ''
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
<!-- Font directories -->
|
||||
${concatStringsSep "\n" (map (font: "<dir>${font}</dir>") config.fonts.fonts)}
|
||||
<!-- Pre-generated font caches -->
|
||||
<cachedir>${cache pkgs.fontconfig}</cachedir>
|
||||
${optionalString (pkgs.stdenv.isx86_64 && config.fonts.fontconfig.cache32Bit) ''
|
||||
<cachedir>${cache pkgs.pkgsi686Linux.fontconfig}</cachedir>
|
||||
''}
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user