From 52de38f5f40a97dc46bbb9a442903f26e087bd30 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 5 Jun 2018 10:37:12 -0400 Subject: [PATCH 1/2] grub-config.xml: handle a null font --- nixos/modules/system/boot/loader/grub/grub.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix index 67daaa333e5edd..2e497ff9f2c495 100644 --- a/nixos/modules/system/boot/loader/grub/grub.nix +++ b/nixos/modules/system/boot/loader/grub/grub.nix @@ -64,9 +64,10 @@ let )) + ":" + (makeSearchPathOutput "bin" "sbin" [ pkgs.mdadm pkgs.utillinux ]); - font = if lib.last (lib.splitString "." cfg.font) == "pf2" + font = if cfg.font == null then "" + else (if lib.last (lib.splitString "." cfg.font) == "pf2" then cfg.font - else "${convertedFont}"; + else "${convertedFont}"); }); bootDeviceCounters = fold (device: attr: attr // { "${device}" = (attr."${device}" or 0) + 1; }) {} From ab889c14b5228fbb1d76f61bfa9bb07558ca053c Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 5 Jun 2018 10:37:38 -0400 Subject: [PATCH 2/2] install-grub: only try to loadfont if font is not null --- .../system/boot/loader/grub/install-grub.pl | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl index 1aa14729a75cbd..872261d0edfa82 100644 --- a/nixos/modules/system/boot/loader/grub/install-grub.pl +++ b/nixos/modules/system/boot/loader/grub/install-grub.pl @@ -281,22 +281,24 @@ sub GrubFs { else insmod vbe fi - insmod font - if loadfont " . $grubBoot->path . "/converted-font.pf2; then - insmod gfxterm - if [ \"\${grub_platform}\" = \"efi\" ]; then - set gfxmode=$gfxmodeEfi - set gfxpayload=keep - else - set gfxmode=$gfxmodeBios - set gfxpayload=text - fi - terminal_output gfxterm - fi "; if ($font) { copy $font, "$bootPath/converted-font.pf2" or die "cannot copy $font to $bootPath\n"; + $conf .= " + insmod font + if loadfont " . $grubBoot->path . "/converted-font.pf2; then + insmod gfxterm + if [ \"\${grub_platform}\" = \"efi\" ]; then + set gfxmode=$gfxmodeEfi + set gfxpayload=keep + else + set gfxmode=$gfxmodeBios + set gfxpayload=text + fi + terminal_output gfxterm + fi + "; } if ($splashImage) { # Keeps the image's extension.