diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix
index ca8313e017b..793b0a250ac 100644
--- a/nixos/modules/config/fonts/fontconfig.nix
+++ b/nixos/modules/config/fonts/fontconfig.nix
@@ -38,29 +38,29 @@ with lib;
defaultFonts = {
monospace = mkOption {
- type = types.str;
- default = "DejaVu Sans Mono";
+ type = types.listOf types.str;
+ default = ["DejaVu Sans Mono"];
description = ''
- System-wide default monospace font. The default is not set if the
- option is set to "".
+ System-wide default monospace font(s). Multiple fonts may be
+ listed in case multiple languages must be supported.
'';
};
sansSerif = mkOption {
- type = types.str;
- default = "DejaVu Sans";
+ type = types.listOf types.str;
+ default = ["DejaVu Sans"];
description = ''
- System-wide default sans serif font. The default is not set if the
- option is set to "".
+ System-wide default sans serif font(s). Multiple fonts may be
+ listed in case multiple languages must be supported.
'';
};
serif = mkOption {
- type = types.str;
- default = "DejaVu Serif";
+ type = types.listOf types.str;
+ default = ["DejaVu Serif"];
description = ''
- System-wide default serif font. The default is not set if the
- option is set to "".
+ System-wide default serif font(s). Multiple fonts may be listed
+ in case multiple languages must be supported.
'';
};
};
@@ -142,16 +142,7 @@ with lib;
config =
let fontconfig = config.fonts.fontconfig;
fcBool = x: "" + (if x then "true" else "false") + "";
- in mkIf fontconfig.enable {
-
- # Fontconfig 2.10 backward compatibility
-
- # Bring in the default (upstream) fontconfig configuration, only for fontconfig 2.10
- environment.etc."fonts/fonts.conf".source =
- pkgs.makeFontsConf { fontconfig = pkgs.fontconfig_210; fontDirectories = config.fonts.fonts; };
-
- environment.etc."fonts/conf.d/98-nixos.conf".text =
- ''
+ nixosConf = ''
@@ -179,27 +170,33 @@ with lib;
- ${optionalString (fontconfig.defaultFonts.sansSerif != "") ''
+ ${optionalString (fontconfig.defaultFonts.sansSerif != []) ''
sans-serif
- ${fontconfig.defaultFonts.sansSerif}
+ ${concatStringsSep "\n"
+ (map (font: "${font}")
+ fontconfig.defaultFonts.sansSerif)}
''}
- ${optionalString (fontconfig.defaultFonts.serif != "") ''
+ ${optionalString (fontconfig.defaultFonts.serif != []) ''
serif
- ${fontconfig.defaultFonts.serif}
+ ${concatStringsSep "\n"
+ (map (font: "${font}")
+ fontconfig.defaultFonts.serif)}
''}
- ${optionalString (fontconfig.defaultFonts.monospace != "") ''
+ ${optionalString (fontconfig.defaultFonts.monospace != []) ''
monospace
- ${fontconfig.defaultFonts.monospace}
+ ${concatStringsSep "\n"
+ (map (font: "${font}")
+ fontconfig.defaultFonts.monospace)}
''}
@@ -214,6 +211,15 @@ with lib;
'';
+ in mkIf fontconfig.enable {
+
+ # Fontconfig 2.10 backward compatibility
+
+ # Bring in the default (upstream) fontconfig configuration, only for fontconfig 2.10
+ environment.etc."fonts/fonts.conf".source =
+ pkgs.makeFontsConf { fontconfig = pkgs.fontconfig_210; fontDirectories = config.fonts.fonts; };
+
+ environment.etc."fonts/conf.d/98-nixos.conf".text = nixosConf;
# Versioned fontconfig > 2.10. Take shared fonts.conf from fontconfig.
# Otherwise specify only font directories.
@@ -230,64 +236,7 @@ with lib;
'';
- environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/98-nixos.conf".text =
- ''
-
-
-
-
-
-
-
- ${fcBool fontconfig.hinting.enable}
-
-
- ${fcBool fontconfig.hinting.autohint}
-
-
- hint${fontconfig.hinting.style}
-
-
- ${fcBool fontconfig.antialias}
-
-
- ${fontconfig.subpixel.rgba}
-
-
- lcd${fontconfig.subpixel.lcdfilter}
-
-
-
-
-
- sans-serif
-
- ${fontconfig.defaultFonts.sansSerif}
-
-
-
- serif
-
- ${fontconfig.defaultFonts.serif}
-
-
-
- monospace
-
- ${fontconfig.defaultFonts.monospace}
-
-
-
- ${optionalString (fontconfig.dpi != 0) ''
-
-
- ${fontconfig.dpi}
-
-
- ''}
-
-
- '';
+ environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/98-nixos.conf".text = nixosConf;
environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/99-user.conf" = {
enable = fontconfig.includeUserConf;