@@ -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