Subject: [bug#76208] gnu: grub: build from git source.

From: Denis 'GNUtoo' Carikli <[email-masked]>
Date: Sat, 15 Feb 2025 17:51:32 +0100

Hi,

My patch contains issues that were found during testing.

If I run:
> $ ./pre-inst-env guix system image --image-type=efi-raw \
> ./minimal-system.scm

With:
> ;;; This file is free software; you can redistribute it and/or modify
> it ;;; under the terms of the GNU General Public License as published
> by ;;; the Free Software Foundation; either version 3 of the License,
> or (at ;;; your option) any later version.
> ;;;
> ;;; This file is distributed in the hope that it will be useful, but
> ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> ;;; GNU General Public License for more details.
> ;;;
> ;;; You should have received a copy of the GNU General Public License
> ;;; along with this file.  If not, see <http://www.gnu.org/licenses/>.
> 
> (define-module (minimal-system)
>   #:use-module (gnu)
>   #:use-module (gnu bootloader)
>   #:use-module (guix build-system copy)
>   #:use-module ((guix licenses) #:prefix license:)
>   #:use-module (guix packages))
> 
> (define-public current-system
>   (package
>     (name "current-system")
>     (version "0.1")
>     (source (local-file (current-filename)))
>     (arguments
>      (list
>       #:install-plan
>       #~(list '(#$(basename (current-filename))
> "share/current-system/")))) (build-system copy-build-system)
>     (synopsis "current guix system definition")
>     (description "The current guix system definition can be used to
> get the file that was used to produce a given image.  If the system
> definition is self-contained, it can also be useful to point
> unattended-upgrade-service to the current system definition file.")
>     (home-page #f)
>     (license license:gpl3+)))
> 
> (define-public minimal-operating-system
>   (operating-system
>    (host-name "minimal")
>    (bootloader (bootloader-configuration
> 		(bootloader grub-bootloader)
> 		(targets '(file-system-label "Guix_image"))
> 		(terminal-outputs '(console))))
>    (file-systems (append (list (file-system
> 				(device (file-system-label
> "Guix_image")) (mount-point "/")
> 				(type "ext4")))
>                          %base-file-systems))
>    (packages (append (list current-system) %base-packages))))
> 
> minimal-operating-system

After working around temporary network with --no-substitutes,  I
get this error:
> -builder for
> `/gnu/store/icskarx900khnyg2f551dfc8mszgrpb6-grub-locales.drv' failed
> with exit code 1 build of
> /gnu/store/icskarx900khnyg2f551dfc8mszgrpb6-grub-locales.drv failed
> View build log at
> '/var/log/guix/drvs/ic/skarx900khnyg2f551dfc8mszgrpb6-grub-locales.drv.gz'.

And this file has that:
> Backtrace:
>            1 (primitive-load
> "/gnu/store/kyc66l3m5pvx6m97z0cyvga4m5b?") In ice-9/boot-9.scm:
>     256:9  0 (for-each #<procedure 7ffff7844840 at ice-9/eval.scm:3?>
> ?)
> 
> ice-9/boot-9.scm:256:9: In procedure for-each:
> In procedure for-each: Not a list: #f

So I probably need to rework the patch somehow.

Also note that so far I only tried to unbundle gnulib, there
are, according to the "6 Updating external code" section in the
grub-dev info manual, 2 more bundled projects[1]:
- jsmn
- minilzo

but they are respectively used to parse JSON and implement LZO, so this
is probably not related to the error I have above.

References:
------------
[1] https://www.gnu.org/software/grub/manual/grub-dev/grub-dev.html#Updating-External-Code

Denis.