mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 07:01:54 +00:00
Adds refind to the installer image.
This is a 277K (as of right now) addition that can greatly help in some last recourse scenarios. The specific rEFInd setup will not be able to boot the installer image, but this is not why it has been added. It has been added to make use of its volumes scanning capabilities to boot existing EFI images on the target computer, which is sometimes necessary with buggy EFI. While is isn't NixOS's job to fix buggy EFI, shipping this small bit with the installer will help the unlucky few. Example scenario: two wildly different EFI implementation I have encountered have fatal flaws in which they sometimes will lose all the settings, this includes boot configuration. This is compounded by the fact that the two specific and distinct implementation do not allow manually adding ESP paths from their interface. The only recourse is to let the EFI boot the default paths, EFI/boot/boot{platform}.efi, which is not a default location used by the NixOS bootloaders. rEFInd is able to scan the volumes and detect the existing efi bootloaders, and boot them successfully.
This commit is contained in:
parent
853475fed7
commit
2f7d9c9f78
@ -98,6 +98,24 @@ let
|
||||
isolinuxCfg = concatStringsSep "\n"
|
||||
([ baseIsolinuxCfg ] ++ optional config.boot.loader.grub.memtest86.enable isolinuxMemtest86Entry);
|
||||
|
||||
# Setup instructions for rEFInd.
|
||||
refind =
|
||||
if targetArch == "x64" then
|
||||
''
|
||||
# Adds rEFInd to the ISO.
|
||||
cp -v ${pkgs.refind}/share/refind/refind_x64.efi $out/EFI/boot/
|
||||
|
||||
# Makes it bootable through systemd-boot.
|
||||
# It purposefully does not have a refind configuration file nor theme.
|
||||
cat << EOF > $out/loader/entries/zz-rEFInd.conf
|
||||
title rEFInd rescue bootloader
|
||||
efi /EFI/boot/refind_x64.efi
|
||||
EOF
|
||||
''
|
||||
else
|
||||
"# No refind for ia32"
|
||||
;
|
||||
|
||||
# The EFI boot image.
|
||||
efiDir = pkgs.runCommand "efi-directory" {} ''
|
||||
mkdir -p $out/EFI/boot
|
||||
@ -141,6 +159,8 @@ let
|
||||
default nixos-iso
|
||||
timeout ${builtins.toString config.boot.loader.timeout}
|
||||
EOF
|
||||
|
||||
${refind}
|
||||
'';
|
||||
|
||||
efiImg = pkgs.runCommand "efi-image_eltorito" { buildInputs = [ pkgs.mtools pkgs.libfaketime ]; }
|
||||
|
Loading…
Reference in New Issue
Block a user