···259259 [headscale's example configuration](https://github.com/juanfont/headscale/blob/main/config-example.yaml)
260260 can be directly written as attribute-set in Nix within this option.
261261262262-- `hardware.video.hidpi` now provides defaults that are consistent with `fontconfig`'s documentation:
263263- - antialiasing and font hinting are disabled, as they have no visible effects at high pixel densities;
264264- - subpixel order isn't set: it was irrelevant with the above disabled, and the module *cannot* know the correct
265265- setting for the user's screen.
262262+- The `hardware.video.hidpi.enable` was renamed to `fonts.optimizeForVeryHighDPI` to be consistent with what it actually does.
263263+ They disable by default: antialiasing, hinting and LCD filter for subpixel rendering. They can be overridden if you experience problems with font rendering.
264264+ On Xorg, the default cursor is upscaled.
265265+ Please see the documentation for the new option to decide if you want to keep it enabled.
266266267267- `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.
268268
+3-5
nixos/modules/config/console.nix
···46464747 font = mkOption {
4848 type = with types; nullOr (either str path);
4949- default = "Lat2-Terminus16";
4949+ default = null;
5050 example = "LatArCyrHeb-16";
5151 description = mdDoc ''
5252- The font used for the virtual consoles. Leave empty to use
5353- whatever the {command}`setfont` program considers the
5454- default font.
5555- Can be either a font name or a path to a PSF font file.
5252+ The font used for the virtual consoles.
5353+ Can be `null`, a font name, or a path to a PSF font file.
56545755 Use `null` to let the kernel choose a built-in font.
5856 The default is 8x16, and, as of Linux 5.3, Terminus 32 bold for display
+23-30
nixos/modules/config/fonts/fonts.nix
···33with lib;
4455let
66- # A scalable variant of the X11 "core" cursor
77- #
88- # If not running a fancy desktop environment, the cursor is likely set to
99- # the default `cursor.pcf` bitmap font. This is 17px wide, so it's very
1010- # small and almost invisible on 4K displays.
1111- fontcursormisc_hidpi = pkgs.xorg.fontxfree86type1.overrideAttrs (old:
1212- let
1313- # The scaling constant is 230/96: the scalable `left_ptr` glyph at
1414- # about 23 points is rendered as 17px, on a 96dpi display.
1515- # Note: the XLFD font size is in decipoints.
1616- size = 2.39583 * config.services.xserver.dpi;
1717- sizeString = builtins.head (builtins.split "\\." (toString size));
1818- in
1919- {
2020- postInstall = ''
2121- alias='cursor -xfree86-cursor-medium-r-normal--0-${sizeString}-0-0-p-0-adobe-fontspecific'
2222- echo "$alias" > $out/lib/X11/fonts/Type1/fonts.alias
2323- '';
2424- });
2525-2626- hasHidpi =
2727- config.hardware.video.hidpi.enable &&
2828- config.services.xserver.dpi != null;
66+ cfg = config.fonts;
297308 defaultFonts =
319 [ pkgs.dejavu_fonts
···3614 pkgs.noto-fonts-emoji
3715 ];
38163939- defaultXFonts =
4040- [ (if hasHidpi then fontcursormisc_hidpi else pkgs.xorg.fontcursormisc)
4141- pkgs.xorg.fontmiscmisc
4242- ];
4343-4417in
45184619{
4720 imports = [
4821 (mkRemovedOptionModule [ "fonts" "enableCoreFonts" ] "Use fonts.fonts = [ pkgs.corefonts ]; instead.")
2222+ (mkRenamedOptionModule [ "hardware" "video" "hidpi" "enable" ] [ "fonts" "optimizeForVeryHighDPI" ])
4923 ];
50245125 options = {
···6943 '';
7044 };
71454646+ optimizeForVeryHighDPI = mkOption {
4747+ type = types.bool;
4848+ default = false;
4949+ description = lib.mdDoc ''
5050+ Optimize configuration for very high-density (>200 DPI) displays:
5151+ - disable subpixel anti-aliasing
5252+ - disable hinting
5353+ - automatically upscale the default X11 cursor
5454+ '';
5555+ };
7256 };
73577458 };
75597660 config = mkMerge [
7777- { fonts.fonts = mkIf config.fonts.enableDefaultFonts defaultFonts; }
7878- { fonts.fonts = mkIf config.services.xserver.enable defaultXFonts; }
6161+ { fonts.fonts = mkIf cfg.enableDefaultFonts defaultFonts; }
6262+ (mkIf cfg.optimizeForVeryHighDPI {
6363+ services.xserver.upscaleDefaultCursor = mkDefault true;
6464+ # Conforms to the recommendation in fonts/fontconfig.nix
6565+ # for > 200DPI.
6666+ fonts.fontconfig = {
6767+ antialias = mkDefault false;
6868+ hinting.enable = mkDefault false;
6969+ subpixel.lcdfilter = mkDefault "none";
7070+ };
7171+ })
7972 ];
80738174}
-25
nixos/modules/hardware/video/hidpi.nix
···11-{ lib, pkgs, config, ...}:
22-with lib;
33-44-{
55- options.hardware.video.hidpi.enable = mkEnableOption (lib.mdDoc "Font/DPI configuration optimized for HiDPI displays");
66-77- config = mkIf config.hardware.video.hidpi.enable {
88- console.font = lib.mkDefault "${pkgs.terminus_font}/share/consolefonts/ter-v32n.psf.gz";
99-1010- # Needed when typing in passwords for full disk encryption
1111- console.earlySetup = mkDefault true;
1212- boot.loader.systemd-boot.consoleMode = mkDefault "1";
1313-1414-1515- # Disable font anti-aliasing, hinting, and sub-pixel rendering by default
1616- # See recommendations in fonts/fontconfig.nix
1717- fonts.fontconfig = {
1818- antialias = mkDefault false;
1919- hinting.enable = mkDefault false;
2020- subpixel.lcdfilter = mkDefault "none";
2121- };
2222-2323- # TODO Find reasonable defaults X11 & wayland
2424- };
2525-}
···518518 }
519519}
520520521521-# For lack of a better way to determine it, guess whether we should use a
522522-# bigger font for the console from the display mode on the first
523523-# framebuffer. A way based on the physical size/actual DPI reported by
524524-# the monitor would be nice, but I don't know how to do this without X :)
525525-my $fb_modes_file = "/sys/class/graphics/fb0/modes";
526526-if (-f $fb_modes_file && -r $fb_modes_file) {
527527- my $modes = read_file($fb_modes_file);
528528- $modes =~ m/([0-9]+)x([0-9]+)/;
529529- my $console_width = $1, my $console_height = $2;
530530- if ($console_width > 1920) {
531531- push @attrs, "# high-resolution display";
532532- push @attrs, 'hardware.video.hidpi.enable = lib.mkDefault true;';
533533- }
534534-}
535535-536521537522# Generate the hardware configuration file.
538523
···58585959 # Dependencies that are required to build kernel modules
6060 moduleBuildDependencies = [
6161+ pahole
6162 perl
6263 libelf
6364 # module makefiles often run uname commands to find out the kernel version
···640640 hardlink = throw "hardlink was merged into util-linux since 2019-06-14."; # Added 2022-08-12
641641 inherit (harePackages) hare harec; # Added 2022-08-10
642642 hawkthorne = throw "hawkthorne has been removed because it depended on a broken version of love"; # Added 2022-01-15
643643+ haxe_3_2 = throw "'haxe_3_2' has been removed because it is old and no longer used by any packages in nixpkgs"; # Added 2023-03-15
644644+ haxe_3_4 = throw "'haxe_3_4' has been removed because it is old and no longer used by any packages in nixpkgs"; # Added 2023-03-15
643645 hdr-plus = throw "hdr-plus has been removed because it is unmaintained, often breaks and no longer consumed as a dependency"; # Added 2022-11-08
644646 heapster = throw "Heapster is now retired. See https://github.com/kubernetes-retired/heapster/blob/master/docs/deprecation.md"; # Added 2022-04-05
645647 heimdalFull = throw "'heimdalFull' has been renamed to/replaced by 'heimdal'"; # Converted to throw 2022-02-22