git.iko.soy/typeable/nixpkgs
on master help sign in
nixos-generate-config: add rudimentary high-DPI detection

Fixes the main remaining part of #12345

commit89b64ab5e1d21bb1ffb4d7fceab46541b3dae237 authorLinus Heckemann <git@sphalerite.org> dateMon 25 Feb 2019, 11:58 (8 years ago) parent61bad5b
1 file changed+15
nixos/modules/installer/tools/nixos-generate-config.pl+15
nixos/modules/installer/tools/nixos-generate-config.pl+15
@@ -464,6 +464,21 @@ EOF
464464 }
465465}
466466
467+# For lack of a better way to determine it, guess whether we should use a
468+# bigger font for the console from the display mode on the first
469+# framebuffer. A way based on the physical size/actual DPI reported by
470+# the monitor would be nice, but I don't know how to do this without X :)
471+my $fb_modes_file = "/sys/class/graphics/fb0/modes";
472+if (-f $fb_modes_file && -r $fb_modes_file) {
473+ my $modes = read_file($fb_modes_file);
474+ $modes =~ m/([0-9]+)x([0-9]+)/;
475+ my $console_width = $1, my $console_height = $2;
476+ if ($console_width > 1920) {
477+ push @attrs, "# High-DPI console";
478+ push @attrs, 'i18n.consoleFont = lib.mkDefault "${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz";';
479+ }
480+}
481+
467482
468483# Generate the hardware configuration file.
469484