nixos/iso-image: Make modules list easier to manage

With a bash array.

This change is morally a no-op.
This commit is contained in:
Samuel Dionne-Riel 2023-08-14 16:49:47 -04:00
parent 362c9430e3
commit fad94acaa8

View File

@ -250,18 +250,61 @@ let
touch $out/EFI/nixos-installer-image touch $out/EFI/nixos-installer-image
# ALWAYS required modules. # ALWAYS required modules.
MODULES="fat iso9660 part_gpt part_msdos \ MODULES=(
normal boot linux configfile loopback chain halt \ # Basic modules for filesystems and partition schemes
efifwsetup efi_gop \ "fat"
ls search search_label search_fs_uuid search_fs_file \ "iso9660"
gfxmenu gfxterm gfxterm_background gfxterm_menu test all_video loadenv \ "part_gpt"
exfat ext2 ntfs btrfs hfsplus udf \ "part_msdos"
videoinfo png \ "exfat"
echo serial \ "ext2"
" "ntfs"
"btrfs"
"hfsplus"
"udf"
# Basic stuff
"normal"
"boot"
"linux"
"configfile"
"loopback"
"chain"
"halt"
# Allows rebooting into firmware setup interface
"efifwsetup"
# EFI Graphics Output Protocol
"efi_gop"
# User commands
"ls"
# System commands
"search"
"search_label"
"search_fs_uuid"
"search_fs_file"
"echo"
"serial"
# Graphical mode stuff
"gfxmenu"
"gfxterm"
"gfxterm_background"
"gfxterm_menu"
"test"
"loadenv"
"all_video"
"videoinfo"
# File types for graphical mode
"png"
)
echo "Building GRUB with modules:" echo "Building GRUB with modules:"
for mod in $MODULES; do for mod in ''${MODULES[@]}; do
echo " - $mod" echo " - $mod"
done done
@ -270,14 +313,18 @@ let
for mod in efi_uga; do for mod in efi_uga; do
if [ -f ${grubPkgs.grub2_efi}/lib/grub/${grubPkgs.grub2_efi.grubTarget}/$mod.mod ]; then if [ -f ${grubPkgs.grub2_efi}/lib/grub/${grubPkgs.grub2_efi.grubTarget}/$mod.mod ]; then
echo " - $mod" echo " - $mod"
MODULES+=" $mod" MODULES+=("$mod")
fi fi
done done
# Make our own efi program, we can't rely on "grub-install" since it seems to # Make our own efi program, we can't rely on "grub-install" since it seems to
# probe for devices, even with --skip-fs-probe. # probe for devices, even with --skip-fs-probe.
grub-mkimage --directory=${grubPkgs.grub2_efi}/lib/grub/${grubPkgs.grub2_efi.grubTarget} -o $out/EFI/boot/boot${targetArch}.efi -p /EFI/boot -O ${grubPkgs.grub2_efi.grubTarget} \ grub-mkimage \
$MODULES --directory=${grubPkgs.grub2_efi}/lib/grub/${grubPkgs.grub2_efi.grubTarget} \
-o $out/EFI/boot/boot${targetArch}.efi \
-p /EFI/boot \
-O ${grubPkgs.grub2_efi.grubTarget} \
''${MODULES[@]}
cp ${grubPkgs.grub2_efi}/share/grub/unicode.pf2 $out/EFI/boot/ cp ${grubPkgs.grub2_efi}/share/grub/unicode.pf2 $out/EFI/boot/
cat <<EOF > $out/EFI/boot/grub.cfg cat <<EOF > $out/EFI/boot/grub.cfg