2014-04-14 14:26:48 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2013-06-27 11:12:45 +00:00
|
|
|
|
2014-04-14 14:26:48 +00:00
|
|
|
with lib;
|
2013-06-27 11:12:45 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
fonts = {
|
|
|
|
|
|
|
|
enableFontConfig = mkOption { # !!! should be enableFontconfig
|
2013-10-30 14:33:20 +00:00
|
|
|
type = types.bool;
|
2013-06-27 11:12:45 +00:00
|
|
|
default = true;
|
|
|
|
description = ''
|
|
|
|
If enabled, a Fontconfig configuration file will be built
|
|
|
|
pointing to a set of default fonts. If you don't care about
|
|
|
|
running X11 applications or any other program that uses
|
|
|
|
Fontconfig, you can turn this option off and prevent a
|
|
|
|
dependency on all those fonts.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
config = mkIf config.fonts.enableFontConfig {
|
|
|
|
|
2014-09-27 18:08:45 +00:00
|
|
|
# Fontconfig 2.10 backward compatibility
|
|
|
|
|
|
|
|
# Bring in the default (upstream) fontconfig configuration, only for fontconfig 2.10
|
2013-06-27 11:12:45 +00:00
|
|
|
environment.etc."fonts/fonts.conf".source =
|
2014-09-27 18:08:45 +00:00
|
|
|
pkgs.makeFontsConf { fontconfig = pkgs.fontconfig_210; fontDirectories = config.fonts.fonts; };
|
2013-06-27 11:12:45 +00:00
|
|
|
|
2013-06-27 11:28:22 +00:00
|
|
|
environment.etc."fonts/conf.d/00-nixos.conf".text =
|
|
|
|
''
|
|
|
|
<?xml version='1.0'?>
|
|
|
|
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
|
|
|
<fontconfig>
|
|
|
|
|
|
|
|
<!-- Set the default hinting style to "slight". -->
|
|
|
|
<match target="font">
|
|
|
|
<edit mode="assign" name="hintstyle">
|
|
|
|
<const>hintslight</const>
|
|
|
|
</edit>
|
|
|
|
</match>
|
|
|
|
|
|
|
|
</fontconfig>
|
|
|
|
'';
|
|
|
|
|
2014-11-04 12:49:22 +00:00
|
|
|
# Versioned fontconfig > 2.10. Take shared fonts.conf from fontconfig.
|
|
|
|
# Otherwise specify only font directories.
|
|
|
|
environment.etc."fonts/${pkgs.fontconfig.configVersion}/fonts.conf".source =
|
|
|
|
"${pkgs.fontconfig}/etc/fonts/fonts.conf";
|
2014-09-27 18:08:45 +00:00
|
|
|
environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/00-nixos.conf".text =
|
|
|
|
''
|
|
|
|
<?xml version='1.0'?>
|
|
|
|
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
|
|
|
<fontconfig>
|
|
|
|
|
|
|
|
<!-- Set the default hinting style to "slight". -->
|
|
|
|
<match target="font">
|
|
|
|
<edit mode="assign" name="hintstyle">
|
|
|
|
<const>hintslight</const>
|
|
|
|
</edit>
|
|
|
|
</match>
|
|
|
|
|
|
|
|
<!-- Font directories -->
|
|
|
|
${concatStringsSep "\n" (map (font: "<dir>${font}</dir>") config.fonts.fonts)}
|
|
|
|
|
|
|
|
</fontconfig>
|
|
|
|
'';
|
|
|
|
|
2013-06-27 11:12:45 +00:00
|
|
|
environment.systemPackages = [ pkgs.fontconfig ];
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|