diff options
author | Linus Heckemann <git@sphalerite.org> | 2019-02-25 11:58:38 +0100 |
---|---|---|
committer | Linus Heckemann <git@sphalerite.org> | 2019-05-15 06:34:40 +0200 |
commit | 89b64ab5e1d21bb1ffb4d7fceab46541b3dae237 (patch) | |
tree | cd2fd39a1155ca0a3f01a7af295fe39c00cb1e08 /nixos/modules/installer | |
parent | 61bad5b84c10f5030bfec027fecfbdb4eb988408 (diff) |
nixos-generate-config: add rudimentary high-DPI detection
Fixes the main remaining part of #12345
Diffstat (limited to 'nixos/modules/installer')
-rw-r--r-- | nixos/modules/installer/tools/nixos-generate-config.pl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl index 686204ee034..b7e5b99a9e0 100644 --- a/nixos/modules/installer/tools/nixos-generate-config.pl +++ b/nixos/modules/installer/tools/nixos-generate-config.pl @@ -464,6 +464,21 @@ EOF } } +# For lack of a better way to determine it, guess whether we should use a +# bigger font for the console from the display mode on the first +# framebuffer. A way based on the physical size/actual DPI reported by +# the monitor would be nice, but I don't know how to do this without X :) +my $fb_modes_file = "/sys/class/graphics/fb0/modes"; +if (-f $fb_modes_file && -r $fb_modes_file) { + my $modes = read_file($fb_modes_file); + $modes =~ m/([0-9]+)x([0-9]+)/; + my $console_width = $1, my $console_height = $2; + if ($console_width > 1920) { + push @attrs, "# High-DPI console"; + push @attrs, 'i18n.consoleFont = lib.mkDefault "${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz";'; + } +} + # Generate the hardware configuration file. |