Subject: [bug#73612] [PATCH 0/2] Add btrfs support and vfat file system options

From: Roman Scherer <[email-masked]>
Date: Thu, 3 Oct 2024 14:11:14 +0200

Hello Guix,

I'm building a disk image for the Asahi Linux installer using Guix.

The Asahi Linux installer has 2 requirements for its disk image:

- It needs a btrfs root partition, so the installer can resize it.
- The block sizes of the vfat and btrfs filesystems need to be 4k.

To create this image, I created my own image type like this:

```
(define asahi-efi-partition
  (partition
   (size (* 500 (expt 2 20)))
   (offset root-offset)
   (label "EFI")
   (file-system "vfat")
   (file-system-options (list "-S" "4096"))
   (flags '(esp))
   (initializer (with-extensions (list guile-zlib)
                  (with-imported-modules (source-module-closure
                                          '((asahi guix build bootloader m1n1))
                                          #:select? import-asahi-module?)
                    #~(lambda* (root . args)
                        (use-modules (asahi guix build bootloader m1n1))
                        (apply m1n1-initialize-efi-partition root args)))))))

(define asahi-root-partition
  (partition
   (size 'guess)
   (label root-label)
   (file-system "btrfs")
   (file-system-options (list "-s" "4096"))
   (flags '(boot))
   (uuid "fef23143-fe46-4f7f-bbb9-efc46a2a5e48")
   (initializer (gexp initialize-root-partition))))
```

Unfortuanatly Guix does not support setting file system options for vfat
partitions, nor btrfs as the root file system of an image. The following 2
patches add support for this.

The first one adds support for file-system-options on vfat file systems. The
code works the same as before, defaulting to 512 block size if no -S option is
provided and the file system is an EFI partition, otherwise it uses the user
provided block size.

The 2nd patch adds support for btrfs to Guix disk images.

With those 2 patches I was able to build a disk image that is compatible with
the Asahi Linux installer. I tested the code by building this image, putting
it on a web server, and then using it with the Asahi Linux installer to
install a Guix system.

Could you please review the patch series and help me to get this into Guix?

Thanks, Roman.

Roman Scherer (2):
  image: Use file system options in make-vfat-image.
  image: Add support for btrfs.

 doc/guix.texi        |  5 +++--
 gnu/build/image.scm  | 43 +++++++++++++++++++++++++++++++++----------
 gnu/system/image.scm |  8 ++++++--
 3 files changed, 42 insertions(+), 14 deletions(-)

base-commit: b522b468cbefcae6170e260ffadadb57f6f5ca54
--
2.46.0