all repos — nixfiles @ 51d8e83616ac4efcb1136efd7740f2e3a486e81b

System and user configuration, managed by nix and home-manager

xserver: configure font stack based on antialias setting
Alan Pearce alan@alanpearce.eu
Fri, 15 Nov 2019 16:49:57 +0100
commit

51d8e83616ac4efcb1136efd7740f2e3a486e81b

parent

e3e50821333e13cb7d964c597336f3805716e60e

1 files changed, 20 insertions(+), 14 deletions(-)

jump to
M system/settings/services/xserver.nixsystem/settings/services/xserver.nix
@@ -1,5 +1,6 @@-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
 
+with lib;
 { services.xserver = {
     enable = true;
     enableCtrlAltBackspace = true;
@@ -36,18 +37,19 @@ fonts = {     enableFontDir = true;
     enableDefaultFonts = false;
     fontconfig = {
-      useEmbeddedBitmaps = true;
-      defaultFonts = {
-        monospace = [ "Liberation Mono" ];
-        sansSerif = [ "Liberation Sans" ];
-        serif = [ "Liberation Serif" ];
+      antialias = true;
+      subpixel = mkIf config.fonts.fontconfig.antialias {
+        lcdfilter = "light";
       };
-      penultimate = {
+      ultimate = mkIf config.fonts.fontconfig.antialias {
         enable = true;
+        preset = "ultimate3";
       };
-      ultimate = {
-        enable = false;
-        preset = "osx";
+      useEmbeddedBitmaps = !config.fonts.fontconfig.antialias;
+      defaultFonts = {
+        monospace = [ "Source Code Pro" ];
+        sansSerif = [ "Tahoma" ];
+        serif = [ "Times New Roman" ];
       };
     };
     fonts = with pkgs; [
@@ -56,14 +58,21 @@ proggyfonts       tamsyn
       terminus_font
 
+      corefonts
+
       fantasque-sans-mono
       emacs-all-the-icons-fonts
+      font-awesome_5
+      xorg.fontmiscmisc
+      xorg.fontcursormisc
+      xorg.fontbhlucidatypewriter100dpi
+    ] ++ lib.optionals config.fonts.fontconfig.antialias [
       fira
       fira-code
       fira-mono
       go-font
-      font-awesome_5
       ibm-plex
+
       liberation_ttf
       mononoki
       roboto
@@ -72,9 +81,6 @@ roboto-slab       source-code-pro
       source-sans-pro
       source-serif-pro
-      xorg.fontmiscmisc
-      xorg.fontcursormisc
-      xorg.fontbhlucidatypewriter100dpi
     ];
   };
 }