1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7
8let
9 cfg = config.fonts;
10in
11{
12 imports = [
13 (lib.mkRemovedOptionModule [
14 "fonts"
15 "enableCoreFonts"
16 ] "Use fonts.packages = [ pkgs.corefonts ]; instead.")
17 (lib.mkRenamedOptionModule [ "fonts" "enableDefaultFonts" ] [ "fonts" "enableDefaultPackages" ])
18 (lib.mkRenamedOptionModule [ "fonts" "fonts" ] [ "fonts" "packages" ])
19 ];
20
21 options = {
22 fonts = {
23 packages = lib.mkOption {
24 type = with lib.types; listOf path;
25 default = [ ];
26 example = lib.literalExpression "[ pkgs.dejavu_fonts ]";
27 description = "List of primary font packages.";
28 };
29
30 enableDefaultPackages = lib.mkOption {
31 type = lib.types.bool;
32 default = false;
33 description = ''
34 Enable a basic set of fonts providing several styles
35 and families and reasonable coverage of Unicode.
36 '';
37 };
38 };
39 };
40
41 config = {
42 fonts.packages = lib.mkIf cfg.enableDefaultPackages (
43 with pkgs;
44 [
45 dejavu_fonts
46 freefont_ttf
47 gyre-fonts # TrueType substitutes for standard PostScript fonts
48 liberation_ttf
49 unifont
50 noto-fonts-color-emoji
51 ]
52 );
53 };
54}