about summary refs log tree commit diff
path: root/modules/common/fonts.nix
blob: adf6a3f876ceb7c3ef22fb27cbae568308b8fb5f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{
  lib,
  pkgs,
  ...
}:
with lib; {
  imports = [
    (mkAliasOptionModule ["fontScheme"] [
      "nixfiles"
      "modules"
      "fonts"
      "fontScheme"
    ])
  ];

  options.nixfiles.modules.fonts = {
    enable = mkEnableOption "fonts and their configurations";

    packages = mkOption {
      description = "Font packages to install.";
      type = with types; listOf package;
      default = with pkgs; [
        (iosevka-bin.override {variant = "aile";})
        (iosevka-bin.override {variant = "etoile";})
        iosevka-bin
        sarasa-gothic
      ];
    };

    fontScheme = let
      mkFont = {
        family,
        style,
        size,
      }: {
        family = mkOption {
          description = "Family of the font.";
          type = types.str;
          default = family;
        };
        style = mkOption {
          description = "Style of the font.";
          type = types.str;
          default = style;
        };
        size = mkOption {
          description = "Size of the font.";
          type = types.int;
          default = size;
        };
      };
    in {
      serifFont = mkFont {
        family = "Iosevka Etoile";
        style = "Regular";
        size = 14;
      };

      serifFontFallback = mkFont {
        family = "Sarasa Gothic J";
        style = "Regular";
        size = 14;
      };

      sansSerifFont = mkFont {
        family = "Iosevka Aile";
        style = "Regular";
        size = 14;
      };

      sansSerifFontFallback = mkFont {
        family = "Sarasa Gothic J";
        style = "Regular";
        size = 14;
      };

      monospaceFont = mkFont {
        family = "Iosevka";
        style = "Regular";
        size = 14;
      };

      monospaceFontFallback = mkFont {
        family = "Sarasa Mono J";
        style = "Regular";
        size = 14;
      };
    };
  };
}

Consider giving Nix/NixOS a try! <3