Add target flag to bootloader

master
noah metz 2023-12-01 15:00:51 -07:00
parent ba5b026ff1
commit d41a72e832
1 changed files with 28 additions and 1 deletions

@ -317,6 +317,33 @@
(modify-services %base-services
(nscd-service-type config => %metznet-nscd-configuration))))
(define install-grub-efi-fix
#~(lambda (bootloader efi-dir mount-point)
;; There is nothing useful to do when called in the context of a disk
;; image generation.
(when efi-dir
;; Install GRUB onto the EFI partition mounted at EFI-DIR, for the
;; system whose root is mounted at MOUNT-POINT.
(let ((grub-install (string-append bootloader "/sbin/grub-install"))
(install-dir (string-append mount-point "/boot"))
;; When installing Guix, it's common to mount EFI-DIR below
;; MOUNT-POINT rather than /boot/efi on the live image.
(target-esp (if (file-exists? (string-append mount-point efi-dir))
(string-append mount-point efi-dir)
efi-dir)))
;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or
;; root partition.
(setenv "GRUB_ENABLE_CRYPTODISK" "y")
(invoke/quiet grub-install "--boot-directory" install-dir
"--target=x86_64-efi"
"--bootloader-id=Guix"
"--efi-directory" target-esp)))))
(define grub-efi-bootloader-fix
(bootloader
(inherit grub-efi-bootloader)
(installer install-grub-efi-fix)))
(define %metznet-base-operating-system
(operating-system
;; Hostname and localization information
@ -332,7 +359,7 @@
(initrd microcode-initrd)
;; Grub UEFI Bootloader installed to /boot/efi
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
(bootloader grub-efi-bootloader-fix)
(targets '("/boot/efi"))
(keyboard-layout keyboard-layout)))
(file-systems (cons* (file-system