about summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2018-06-05 13:29:28 -0400
committerGitHub <noreply@github.com>2018-06-05 13:29:28 -0400
commit5467f0ed7add4713f7a3802ef2a2865adeb0e08c (patch)
tree92018a7ad52de2fec917b58942a8574f3cc9718d /nixos/modules/system
parentbd0058453a058c07db3b15b7def1d4339aaca848 (diff)
parentab889c14b5228fbb1d76f61bfa9bb07558ca053c (diff)
downloadnixlib-5467f0ed7add4713f7a3802ef2a2865adeb0e08c.tar
nixlib-5467f0ed7add4713f7a3802ef2a2865adeb0e08c.tar.gz
nixlib-5467f0ed7add4713f7a3802ef2a2865adeb0e08c.tar.bz2
nixlib-5467f0ed7add4713f7a3802ef2a2865adeb0e08c.tar.lz
nixlib-5467f0ed7add4713f7a3802ef2a2865adeb0e08c.tar.xz
nixlib-5467f0ed7add4713f7a3802ef2a2865adeb0e08c.tar.zst
nixlib-5467f0ed7add4713f7a3802ef2a2865adeb0e08c.zip
Merge pull request #41486 from grahamc/support-null-font
grub: Support when boot.loader.grub.font is null
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/loader/grub/grub.nix5
-rw-r--r--nixos/modules/system/boot/loader/grub/install-grub.pl26
2 files changed, 17 insertions, 14 deletions
diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix
index 67daaa333e5e..2e497ff9f2c4 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; }) {}
diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl
index 1aa14729a75c..872261d0edfa 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 @@ else {
         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.