From 3ffdf466bb57cf285afae54d4ee86823e4322fee Mon Sep 17 00:00:00 2001 From: chn Date: Thu, 1 Feb 2024 12:38:52 +0800 Subject: [PATCH] system.grub: add efi shell --- modules/system/grub.nix | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/system/grub.nix b/modules/system/grub.nix index 3732cbca..9bab806f 100644 --- a/modules/system/grub.nix +++ b/modules/system/grub.nix @@ -35,8 +35,10 @@ inputs: boot.loader.grub = { memtest86.enable = true; - extraEntries = builtins.concatStringsSep "\n" - ( + extraFiles = inputs.lib.mkIf (builtins.elem grub.installDevice [ "efi" "efiRemovable" ]) + { "shell.efi" = "${inputs.pkgs.edk2-uefi-shell}/shell.efi"; }; + extraEntries = inputs.lib.mkMerge (builtins.concatLists + [ (builtins.map (system: '' @@ -50,7 +52,7 @@ inputs: } '') (inputs.localLib.attrsToList grub.windowsEntries)) - ++ [ + [ '' menuentry "System shutdown" { echo "System shutting down..." @@ -67,10 +69,15 @@ inputs: menuentry 'UEFI Firmware Settings' --id 'uefi-firmware' { fwsetup } + menuentry "UEFI Shell" { + insmod fat + insmod chain + chainloader @bootRoot@/shell.efi + } '' ) ] - ); + ]); }; } ];