nixos/grub: Prevent module errors and make gfxmode configurable
This commit is contained in:
parent
aece1407d5
commit
c891134b77
|
@ -28,7 +28,7 @@ let
|
|||
f = x: if x == null then "" else "" + x;
|
||||
|
||||
grubConfig = args: pkgs.writeText "grub-config.xml" (builtins.toXML
|
||||
{ splashImage = f config.boot.loader.grub.splashImage;
|
||||
{ splashImage = f cfg.splashImage;
|
||||
grub = f grub;
|
||||
grubTarget = f (grub.grubTarget or "");
|
||||
shell = "${pkgs.stdenv.shell}";
|
||||
|
@ -42,7 +42,7 @@ let
|
|||
inherit (cfg)
|
||||
version extraConfig extraPerEntryConfig extraEntries
|
||||
extraEntriesBeforeNixOS extraPrepareConfig configurationLimit copyKernels timeout
|
||||
default fsIdentifier efiSupport;
|
||||
default fsIdentifier efiSupport gfxmodeEfi gfxmodeBios;
|
||||
path = (makeSearchPath "bin" ([
|
||||
pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.findutils pkgs.diffutils pkgs.btrfsProgs
|
||||
pkgs.utillinux ] ++ (if cfg.efiSupport && (cfg.version == 2) then [pkgs.efibootmgr ] else [])
|
||||
|
@ -242,6 +242,24 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
gfxmodeEfi = mkOption {
|
||||
default = "auto";
|
||||
example = "1024x768";
|
||||
type = types.str;
|
||||
description = ''
|
||||
The gfxmode to pass to grub when loading a graphical boot interface under efi.
|
||||
'';
|
||||
};
|
||||
|
||||
gfxmodeBios = mkOption {
|
||||
default = "1024x768";
|
||||
example = "auto";
|
||||
type = types.str;
|
||||
description = ''
|
||||
The gfxmode to pass to grub when loading a graphical boot interface under bios.
|
||||
'';
|
||||
};
|
||||
|
||||
configurationLimit = mkOption {
|
||||
default = 100;
|
||||
example = 120;
|
||||
|
|
|
@ -57,6 +57,8 @@ my $grubTargetEfi = get("grubTargetEfi");
|
|||
my $bootPath = get("bootPath");
|
||||
my $canTouchEfiVariables = get("canTouchEfiVariables");
|
||||
my $efiSysMountPoint = get("efiSysMountPoint");
|
||||
my $gfxmodeEfi = get("gfxmodeEfi");
|
||||
my $gfxmodeBios = get("gfxmodeBios");
|
||||
$ENV{'PATH'} = get("path");
|
||||
|
||||
die "unsupported GRUB version\n" if $grubVersion != 1 && $grubVersion != 2;
|
||||
|
@ -255,14 +257,22 @@ else {
|
|||
fi
|
||||
|
||||
# Setup the graphics stack for bios and efi systems
|
||||
insmod vbe
|
||||
insmod efi_gop
|
||||
insmod efi_uga
|
||||
if [ \"\${grub_platform}\" = \"efi\" ]; then
|
||||
insmod efi_gop
|
||||
insmod efi_uga
|
||||
else
|
||||
insmod vbe
|
||||
fi
|
||||
insmod font
|
||||
if loadfont " . $grubBoot->path . "/grub/fonts/unicode.pf2; then
|
||||
insmod gfxterm
|
||||
set gfxmode=auto
|
||||
set gfxpayload=keep
|
||||
if [ \"\${grub_platform}\" = \"efi\" ]; then
|
||||
set gfxmode=$gfxmodeEfi
|
||||
set gfxpayload=keep
|
||||
else
|
||||
set gfxmode=$gfxmodeBios
|
||||
set gfxpayload=text
|
||||
fi
|
||||
terminal_output gfxterm
|
||||
fi
|
||||
";
|
||||
|
|
Loading…
Reference in New Issue