From 5b5c2fb9c08e3e9ee4ed27fce7863055d3c896d1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 5 Sep 2016 15:48:48 +0200 Subject: [PATCH] Make the default fonts conditional on services.xserver.enable We were pulling in 44 MiB of fonts in the default configuration, which is a bit excessive for headless configurations like EC2 instances. Note that dejavu_minimal ensures that remote X11-forwarded applications still have a basic font regardless. --- nixos/modules/config/fonts/fonts.nix | 12 +++++++++++- nixos/modules/services/x11/xserver.nix | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/nixos/modules/config/fonts/fonts.nix b/nixos/modules/config/fonts/fonts.nix index f913b8c33e5..af3d93fc1bc 100644 --- a/nixos/modules/config/fonts/fonts.nix +++ b/nixos/modules/config/fonts/fonts.nix @@ -11,17 +11,27 @@ with lib; # TODO: find another name for it. fonts = mkOption { type = types.listOf types.path; + default = []; example = literalExample "[ pkgs.dejavu_fonts ]"; description = "List of primary font paths."; }; + enableDefaultFonts = mkOption { + type = types.bool; + default = false; + description = '' + Enable a basic set of fonts providing several font styles + and families and reasonable coverage of Unicode. + ''; + }; + }; }; config = { - fonts.fonts = + fonts.fonts = mkIf config.fonts.enableDefaultFonts [ pkgs.xorg.fontbhlucidatypewriter100dpi pkgs.xorg.fontbhlucidatypewriter75dpi diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index b03f70385b1..6c6a1e79ed0 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -654,6 +654,8 @@ in ${xrandrMonitorSections} ''; + fonts.enableDefaultFonts = mkDefault true; + }; }