Unverified Commit 0dd7df1c authored by Philip Taron's avatar Philip Taron Committed by GitHub
Browse files

nixos/limine: add resolution option for Linux boot entries (#480458)

parents 344cecdc ffffc8aa
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -291,6 +291,12 @@ def config_entry(levels: int, bootspec: BootSpec, label: str, time: str) -> str:
    entry += f'comment: {bootspec.label}, built on {time}\n'
    entry += 'kernel_path: ' + get_kernel_uri(bootspec.kernel) + '\n'
    entry += 'cmdline: ' + ' '.join(['init=' + bootspec.init] + bootspec.kernelParams).strip() + '\n'

    # Set framebuffer resolution for Linux boot entries if configured
    resolution = config('resolution')
    if resolution is not None:
        entry += f'resolution: {resolution}\n'

    if bootspec.initrd:
        entry += f'module_path: ' + get_kernel_uri(bootspec.initrd) + '\n'

+22 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ let
      force = cfg.force;
      enrollConfig = cfg.enrollConfig;
      style = cfg.style;
      resolution = cfg.resolution;
      maxGenerations = if cfg.maxGenerations == null then 0 else cfg.maxGenerations;
      hostArchitecture = pkgs.stdenv.hostPlatform.parsed.cpu;
      timeout = if config.boot.loader.timeout != null then config.boot.loader.timeout else 10;
@@ -98,6 +99,27 @@ in
      '';
    };

    resolution = lib.mkOption {
      default = null;
      type = lib.types.nullOr lib.types.str;
      example = "1920x1080x32";
      description = ''
        The framebuffer resolution to set when booting Linux entries.
        This controls the GOP mode that Limine sets before handing off to the kernel,
        which affects early boot graphics (e.g., simpledrm, efifb).

        Format: `<width>x<height>` or `<width>x<height>x<bpp>`.
        If bpp is omitted, defaults to 32.

        Note: Refresh rate is not supported because the UEFI GOP protocol only
        defines framebuffer dimensions and pixel format, not display timing.
        Refresh rate is determined later by the GPU driver based on EDID.

        This is distinct from {option}`boot.loader.limine.style.interface.resolution`
        which only affects the Limine bootloader's own menu interface.
      '';
    };

    additionalFiles = lib.mkOption {
      default = { };
      type = lib.types.attrsOf lib.types.path;