···
isolinuxCfg = concatStringsSep "\n"
([ baseIsolinuxCfg ] ++ optional config.boot.loader.grub.memtest86.enable isolinuxMemtest86Entry);
165
+
refindBinary = if targetArch == "x64" || targetArch == "aa64" then "refind_${targetArch}.efi" else null;
# Setup instructions for rEFInd.
167
-
if targetArch == "x64" then
169
+
if refindBinary != null then
# Adds rEFInd to the ISO.
170
-
cp -v ${pkgs.refind}/share/refind/refind_x64.efi $out/EFI/boot/
172
+
cp -v ${pkgs.refind}/share/refind/${refindBinary} $out/EFI/boot/
"# No refind for ${targetArch}"
···
# (This font is assumed to always be provided as a fallback by NixOS)
189
-
if loadfont (hd0)/EFI/boot/unicode.pf2; then
191
+
if loadfont /EFI/boot/unicode.pf2; then
192
+
set with_fonts=true
194
+
if [ "\$textmode" != "true" -a "\$with_fonts" == "true" ]; then
# Use graphical term, it can be either with background image or a theme.
# input is "console", while output is "gfxterm".
# This enables "serial" input and output only when possible.
···
${ # When there is a theme configured, use it, otherwise use the background image.
if config.isoImage.grubTheme != null then ''
210
-
set theme=(hd0)/EFI/boot/grub-theme/theme.txt
215
+
set theme=/EFI/boot/grub-theme/theme.txt
212
-
$(find ${config.isoImage.grubTheme} -iname '*.pf2' -printf "loadfont (hd0)/EFI/boot/grub-theme/%P\n")
217
+
$(find ${config.isoImage.grubTheme} -iname '*.pf2' -printf "loadfont /EFI/boot/grub-theme/%P\n")
214
-
if background_image (hd0)/EFI/boot/efi-background.png; then
219
+
if background_image /EFI/boot/efi-background.png; then
# Black background means transparent background when there
# is a background image set... This seems undocumented :(
set color_normal=black/black
···
cat <<EOF > $out/EFI/boot/grub.cfg
272
+
set with_fonts=false
# If you want to use serial for "terminal_*" commands, you need to set one up:
# Example manual configuration:
# → serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
···
284
+
# This message will only be viewable when "gfxterm" is not used.
286
+
echo "Loading graphical boot menu..."
288
+
echo "Press 't' to use the text boot menu on this console..."
293
+
hiddenentry 'Text mode' --hotkey 't' {
294
+
loadfont /EFI/boot/unicode.pf2
296
+
terminal_output gfxterm console
298
+
hiddenentry 'GUI mode' --hotkey 'g' {
299
+
$(find ${config.isoImage.grubTheme} -iname '*.pf2' -printf "loadfont /EFI/boot/grub-theme/%P\n")
301
+
terminal_output gfxterm
# If the parameter iso_path is set, append the findiso parameter to the kernel
# line. We need this to allow the nixos iso to be booted from grub directly.
if [ \''${iso_path} ] ; then
···
340
-
menuentry 'rEFInd' --class refind {
341
-
# UUID is hard-coded in the derivation.
342
-
search --set=root --no-floppy --fs-uuid 1234-5678
343
-
chainloader (\$root)/EFI/boot/refind_x64.efi
367
+
${lib.optionalString (refindBinary != null) ''
368
+
# GRUB apparently cannot do "chainloader" operations on "CD".
369
+
if [ "\$root" != "cd0" ]; then
370
+
menuentry 'rEFInd' --class refind {
371
+
# \$root defaults to the drive the EFI is found on.
372
+
chainloader (\$root)/EFI/boot/${refindBinary}
menuentry 'Firmware Setup' --class settings {