diff options
author | Nikolay Amiantov <ab@fmap.me> | 2016-01-29 14:40:51 +0300 |
---|---|---|
committer | Nikolay Amiantov <ab@fmap.me> | 2016-01-29 14:41:26 +0300 |
commit | 39b5bc3b2f6b214e65c39ab74baa10eba0c7d7a3 (patch) | |
tree | 5ba8a91eb726336d3a470bc03931ca98b9591e60 /nixos/modules/config/fonts | |
parent | 893af77556897ac81066ffa378aed854daf3b258 (diff) |
fontconfig service: add pre-generated fonts caches
Diffstat (limited to 'nixos/modules/config/fonts')
-rw-r--r-- | nixos/modules/config/fonts/fontconfig.nix | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix index be6662decea6..e078a75b295c 100644 --- a/nixos/modules/config/fonts/fontconfig.nix +++ b/nixos/modules/config/fonts/fontconfig.nix @@ -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> ''; |