From f03716715f663f1c45056b7df450cf1b7386181b Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 5 Oct 2022 16:06:12 +0200 Subject: [PATCH 1/6] nixos/hidpi: Disable anti-aliasing Per the documentation: > At high resolution (> 200 DPI), antialiasing has no visible effect; > users of such displays may want to disable this option. --- nixos/modules/hardware/video/hidpi.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/hardware/video/hidpi.nix b/nixos/modules/hardware/video/hidpi.nix index 8c8f8bc0c265..8936b92230b2 100644 --- a/nixos/modules/hardware/video/hidpi.nix +++ b/nixos/modules/hardware/video/hidpi.nix @@ -12,8 +12,8 @@ with lib; boot.loader.systemd-boot.consoleMode = mkDefault "1"; - # Grayscale anti-aliasing for fonts - fonts.fontconfig.antialias = mkDefault true; + # Disable font anti-aliasing & sub-pixel rendering by default + fonts.fontconfig.antialias = mkDefault false; fonts.fontconfig.subpixel = { rgba = mkDefault "none"; lcdfilter = mkDefault "none"; From b2366655e2ee2b284f530509114bf873c1601973 Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 5 Oct 2022 16:07:22 +0200 Subject: [PATCH 2/6] nixos/hidpi: Disable font hinting Per the documentation: > At high resolution (> 200 dpi) hinting will do nothing (at best); > users of such displays may want to disable this option. --- nixos/modules/hardware/video/hidpi.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nixos/modules/hardware/video/hidpi.nix b/nixos/modules/hardware/video/hidpi.nix index 8936b92230b2..db325976e26c 100644 --- a/nixos/modules/hardware/video/hidpi.nix +++ b/nixos/modules/hardware/video/hidpi.nix @@ -12,8 +12,9 @@ with lib; boot.loader.systemd-boot.consoleMode = mkDefault "1"; - # Disable font anti-aliasing & sub-pixel rendering by default + # Disable font anti-aliasing, hinting, and sub-pixel rendering by default fonts.fontconfig.antialias = mkDefault false; + fonts.fontconfig.hinting.enable = mkDefault false; fonts.fontconfig.subpixel = { rgba = mkDefault "none"; lcdfilter = mkDefault "none"; From e1220cf121328e2f851a0a8458a2891d07361a60 Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 5 Oct 2022 16:08:14 +0200 Subject: [PATCH 3/6] nixos/hidpi: Don't set subpixel order It has no effect with `subpixel.lcdfilter = "none"`. If the user overrides the module's default, the correct subpixel order depends on their actual monitor, and cannot be known by this module. --- nixos/modules/hardware/video/hidpi.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/nixos/modules/hardware/video/hidpi.nix b/nixos/modules/hardware/video/hidpi.nix index db325976e26c..f907d0a4706e 100644 --- a/nixos/modules/hardware/video/hidpi.nix +++ b/nixos/modules/hardware/video/hidpi.nix @@ -15,10 +15,7 @@ with lib; # Disable font anti-aliasing, hinting, and sub-pixel rendering by default fonts.fontconfig.antialias = mkDefault false; fonts.fontconfig.hinting.enable = mkDefault false; - fonts.fontconfig.subpixel = { - rgba = mkDefault "none"; - lcdfilter = mkDefault "none"; - }; + fonts.fontconfig.subpixel.lcdfilter = mkDefault "none"; # TODO Find reasonable defaults X11 & wayland }; From fc65af6a746ca0d9b219775655f8ed4c079caa99 Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 5 Oct 2022 16:11:48 +0200 Subject: [PATCH 4/6] nixos/hidpi: Minor refactor --- nixos/modules/hardware/video/hidpi.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nixos/modules/hardware/video/hidpi.nix b/nixos/modules/hardware/video/hidpi.nix index f907d0a4706e..c48d1dbe18eb 100644 --- a/nixos/modules/hardware/video/hidpi.nix +++ b/nixos/modules/hardware/video/hidpi.nix @@ -13,9 +13,11 @@ with lib; # Disable font anti-aliasing, hinting, and sub-pixel rendering by default - fonts.fontconfig.antialias = mkDefault false; - fonts.fontconfig.hinting.enable = mkDefault false; - fonts.fontconfig.subpixel.lcdfilter = mkDefault "none"; + fonts.fontconfig = { + antialias = mkDefault false; + hinting.enable = mkDefault false; + subpixel.lcdfilter = mkDefault "none"; + }; # TODO Find reasonable defaults X11 & wayland }; From 5e118ba9ed580723587360d1d37e9e73a9f0a393 Mon Sep 17 00:00:00 2001 From: nicoo Date: Fri, 3 Mar 2023 12:50:28 +0000 Subject: [PATCH 5/6] nixos/hidpi: Add release notes entry for 23.05 --- nixos/doc/manual/release-notes/rl-2305.section.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nixos/doc/manual/release-notes/rl-2305.section.md b/nixos/doc/manual/release-notes/rl-2305.section.md index 1fe577822985..0278edfd9644 100644 --- a/nixos/doc/manual/release-notes/rl-2305.section.md +++ b/nixos/doc/manual/release-notes/rl-2305.section.md @@ -209,6 +209,11 @@ In addition to numerous new and upgraded packages, this release has the followin [headscale's example configuration](https://github.com/juanfont/headscale/blob/main/config-example.yaml) can be directly written as attribute-set in Nix within this option. +- `hardware.video.hidpi` now provides defaults that are consistent with `fontconfig`'s documentation: + - antialiasing and font hinting are disabled, as they have no visible effects at high pixel densities; + - subpixel order isn't set: it was irrelevant with the above disabled, and the module *cannot* know the correct + setting for the user's screen. + - `nixos/lib/make-disk-image.nix` can now mutate EFI variables, run user-provided EFI firmware or variable templates. This is now extensively documented in the NixOS manual. - `services.grafana` listens only on localhost by default again. This was changed to upstreams default of `0.0.0.0` by accident in the freeform setting conversion. From df4faec23b11dfe721b8676d7812e6e165b43163 Mon Sep 17 00:00:00 2001 From: nicoo Date: Sun, 12 Mar 2023 21:33:38 +0000 Subject: [PATCH 6/6] nixos/hidpi: Explicitely refer to fontconfig.nix for the choice of defaults --- nixos/modules/hardware/video/hidpi.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/modules/hardware/video/hidpi.nix b/nixos/modules/hardware/video/hidpi.nix index c48d1dbe18eb..fe63784e57f5 100644 --- a/nixos/modules/hardware/video/hidpi.nix +++ b/nixos/modules/hardware/video/hidpi.nix @@ -13,6 +13,7 @@ with lib; # Disable font anti-aliasing, hinting, and sub-pixel rendering by default + # See recommendations in fonts/fontconfig.nix fonts.fontconfig = { antialias = mkDefault false; hinting.enable = mkDefault false;