{ lib, config, pkgs, ... }: with lib; let cfg = config.modules.fontconfig; aliasConfig = font: '' ${font.name} ${font.name} ${concatStrings (map (font: " ${font}\n") font.fallbackFonts)} ''; configContent = concatStrings ( map (font: aliasConfig config.theming.fonts.pkgs.${font}) config.theming.fonts.installed ); in { options.modules.fontconfig = { enable = mkEnableOption "fontconfig"; }; config = mkIf cfg.enable { fonts.fontconfig = { enable = true; defaultFonts = { serif = [ config.theming.fonts.serif.name ]; sansSerif = [ config.theming.fonts.sansSerif.name ]; monospace = [ config.theming.fonts.monospace.name ]; emoji = [ config.theming.fonts.emoji.name ]; }; }; home.file.".config/fontconfig/conf.d/20-family-fallbacks.conf" = { enable = true; # text = '' # # # ${configContent} # # ''; text = '' ${configContent} ''; }; }; }