diff options
author | Azat Bahawi <azat@bahawi.net> | 2023-02-19 17:50:35 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2023-02-19 17:50:35 +0300 |
commit | 91fb4f28ef5d87e8bcf7749928d30ba4a9cbbd34 (patch) | |
tree | e07291fcb1cf62a561ffe58d1fd8e2968ff6fcb3 /modules/common/fonts.nix | |
parent | f1e8dc736a904703eaa97ccf3d5cde3f69101c38 (diff) |
2023-02-19
Diffstat (limited to 'modules/common/fonts.nix')
-rw-r--r-- | modules/common/fonts.nix | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/modules/common/fonts.nix b/modules/common/fonts.nix new file mode 100644 index 0000000..483de0d --- /dev/null +++ b/modules/common/fonts.nix @@ -0,0 +1,91 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.nixfiles.modules.fonts; +in { + imports = [ + (mkAliasOptionModule ["fontScheme"] [ + "nixfiles" + "modules" + "fonts" + "fontScheme" + ]) + ]; + + options.nixfiles.modules.fonts = { + enable = mkEnableOption "fonts and their configurations"; + + 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; + }; + }; + }; + + config = mkIf cfg.enable { + fonts.fonts = with pkgs; [ + iosevka-bin + (iosevka-bin.override {variant = "aile";}) + (iosevka-bin.override {variant = "etoile";}) + sarasa-gothic + ]; + }; +} |