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;
|
f = x: if x == null then "" else "" + x;
|
||||||
|
|
||||||
grubConfig = args: pkgs.writeText "grub-config.xml" (builtins.toXML
|
grubConfig = args: pkgs.writeText "grub-config.xml" (builtins.toXML
|
||||||
{ splashImage = f config.boot.loader.grub.splashImage;
|
{ splashImage = f cfg.splashImage;
|
||||||
grub = f grub;
|
grub = f grub;
|
||||||
grubTarget = f (grub.grubTarget or "");
|
grubTarget = f (grub.grubTarget or "");
|
||||||
shell = "${pkgs.stdenv.shell}";
|
shell = "${pkgs.stdenv.shell}";
|
||||||
|
@ -42,7 +42,7 @@ let
|
||||||
inherit (cfg)
|
inherit (cfg)
|
||||||
version extraConfig extraPerEntryConfig extraEntries
|
version extraConfig extraPerEntryConfig extraEntries
|
||||||
extraEntriesBeforeNixOS extraPrepareConfig configurationLimit copyKernels timeout
|
extraEntriesBeforeNixOS extraPrepareConfig configurationLimit copyKernels timeout
|
||||||
default fsIdentifier efiSupport;
|
default fsIdentifier efiSupport gfxmodeEfi gfxmodeBios;
|
||||||
path = (makeSearchPath "bin" ([
|
path = (makeSearchPath "bin" ([
|
||||||
pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.findutils pkgs.diffutils pkgs.btrfsProgs
|
pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.findutils pkgs.diffutils pkgs.btrfsProgs
|
||||||
pkgs.utillinux ] ++ (if cfg.efiSupport && (cfg.version == 2) then [pkgs.efibootmgr ] else [])
|
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 {
|
configurationLimit = mkOption {
|
||||||
default = 100;
|
default = 100;
|
||||||
example = 120;
|
example = 120;
|
||||||
|
|
|
@ -57,6 +57,8 @@ my $grubTargetEfi = get("grubTargetEfi");
|
||||||
my $bootPath = get("bootPath");
|
my $bootPath = get("bootPath");
|
||||||
my $canTouchEfiVariables = get("canTouchEfiVariables");
|
my $canTouchEfiVariables = get("canTouchEfiVariables");
|
||||||
my $efiSysMountPoint = get("efiSysMountPoint");
|
my $efiSysMountPoint = get("efiSysMountPoint");
|
||||||
|
my $gfxmodeEfi = get("gfxmodeEfi");
|
||||||
|
my $gfxmodeBios = get("gfxmodeBios");
|
||||||
$ENV{'PATH'} = get("path");
|
$ENV{'PATH'} = get("path");
|
||||||
|
|
||||||
die "unsupported GRUB version\n" if $grubVersion != 1 && $grubVersion != 2;
|
die "unsupported GRUB version\n" if $grubVersion != 1 && $grubVersion != 2;
|
||||||
|
@ -255,14 +257,22 @@ else {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Setup the graphics stack for bios and efi systems
|
# Setup the graphics stack for bios and efi systems
|
||||||
insmod vbe
|
if [ \"\${grub_platform}\" = \"efi\" ]; then
|
||||||
insmod efi_gop
|
insmod efi_gop
|
||||||
insmod efi_uga
|
insmod efi_uga
|
||||||
|
else
|
||||||
|
insmod vbe
|
||||||
|
fi
|
||||||
insmod font
|
insmod font
|
||||||
if loadfont " . $grubBoot->path . "/grub/fonts/unicode.pf2; then
|
if loadfont " . $grubBoot->path . "/grub/fonts/unicode.pf2; then
|
||||||
insmod gfxterm
|
insmod gfxterm
|
||||||
set gfxmode=auto
|
if [ \"\${grub_platform}\" = \"efi\" ]; then
|
||||||
|
set gfxmode=$gfxmodeEfi
|
||||||
set gfxpayload=keep
|
set gfxpayload=keep
|
||||||
|
else
|
||||||
|
set gfxmode=$gfxmodeBios
|
||||||
|
set gfxpayload=text
|
||||||
|
fi
|
||||||
terminal_output gfxterm
|
terminal_output gfxterm
|
||||||
fi
|
fi
|
||||||
";
|
";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user