{ options, config, pkgs, lib, namespace, ... }: with lib; with lib.${namespace}; let cfg = config.${namespace}.system.fonts; in { options.${namespace}.system.fonts = with types; { enable = mkBoolOpt false "Whether or not to manage fonts."; emoji = mkBoolOpt false "Whether or not to enable emojis."; fonts = mkOpt (listOf package) [ ] "Custom font packages to install."; }; config = mkIf cfg.enable { environment.variables = { LOG_ICONS = "true"; }; environment.systemPackages = with pkgs; [ font-manager ]; fonts = { fontconfig = mkIf cfg.emoji { enable = true; localConf = '' monospace emoji sans-serif emoji serif emoji ''; defaultFonts = { emoji = [ "Noto Color Emoji" ]; monospace = [ "FreeMono" ]; sansSerif = [ "FreeSans" ]; serif = [ "FreeSerif" ]; }; }; packages = with pkgs; [ twemoji-color-font noto-fonts noto-fonts-cjk-sans noto-fonts-cjk-serif noto-fonts-emoji (nerdfonts.override { fonts = [ "Hack" ]; }) ] ++ cfg.fonts; }; }; }