guix system: Add "--file-system-type" option.
* guix/scripts/system.scm (process-action): Pass file-system-type to ... (perform-action): ... here. Add new keyword argument. Pass new value to ... (system-derivation-for-action): ... here. Add new keyword argument. Pass new value to system-disk-image. * doc/guix.texi (disk-image): Document new option.
This commit is contained in:
		
							parent
							
								
									85c774808f
								
							
						
					
					
						commit
						3f4d8a7f66
					
				
					 2 changed files with 35 additions and 4 deletions
				
			
		| 
						 | 
					@ -16190,6 +16190,9 @@ in @var{file} that stands alone.  By default, @command{guix system}
 | 
				
			||||||
estimates the size of the image needed to store the system, but you can
 | 
					estimates the size of the image needed to store the system, but you can
 | 
				
			||||||
use the @option{--image-size} option to specify a value.
 | 
					use the @option{--image-size} option to specify a value.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You can specify the root file system type by using the
 | 
				
			||||||
 | 
					@option{--file-system-type} option.  It defaults to "ext4".
 | 
				
			||||||
 | 
					
 | 
				
			||||||
When using @code{vm-image}, the returned image is in qcow2 format, which
 | 
					When using @code{vm-image}, the returned image is in qcow2 format, which
 | 
				
			||||||
the QEMU emulator can efficiently use. @xref{Running GuixSD in a VM},
 | 
					the QEMU emulator can efficiently use. @xref{Running GuixSD in a VM},
 | 
				
			||||||
for more information on how to run the image in a virtual machine.
 | 
					for more information on how to run the image in a virtual machine.
 | 
				
			||||||
| 
						 | 
					@ -16245,6 +16248,19 @@ This works as per @command{guix build} (@pxref{Invoking guix build}).
 | 
				
			||||||
Return the derivation file name of the given operating system without
 | 
					Return the derivation file name of the given operating system without
 | 
				
			||||||
building anything.
 | 
					building anything.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@item --file-system-type=@var{type}
 | 
				
			||||||
 | 
					@itemx -t @var{type}
 | 
				
			||||||
 | 
					For the @code{disk-image} action, create a file system of the given
 | 
				
			||||||
 | 
					@var{type} on the image.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					When this option is omitted, @command{guix system} uses @code{ext4}.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@cindex ISO-9660 format
 | 
				
			||||||
 | 
					@cindex CD image format
 | 
				
			||||||
 | 
					@cindex DVD image format
 | 
				
			||||||
 | 
					@code{--file-system-type=iso9660} produces an ISO-9660 image, suitable
 | 
				
			||||||
 | 
					for burning on CDs and DVDs.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@item --image-size=@var{size}
 | 
					@item --image-size=@var{size}
 | 
				
			||||||
For the @code{vm-image} and @code{disk-image} actions, create an image
 | 
					For the @code{vm-image} and @code{disk-image} actions, create an image
 | 
				
			||||||
of the given @var{size}.  @var{size} may be a number of bytes, or it may
 | 
					of the given @var{size}.  @var{size} may be a number of bytes, or it may
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -560,7 +560,8 @@ PATTERN, a string.  When PATTERN is #f, display all the system generations."
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define* (system-derivation-for-action os action
 | 
					(define* (system-derivation-for-action os action
 | 
				
			||||||
                                       #:key image-size full-boot? mappings)
 | 
					                                       #:key image-size file-system-type
 | 
				
			||||||
 | 
					                                       full-boot? mappings)
 | 
				
			||||||
  "Return as a monadic value the derivation for OS according to ACTION."
 | 
					  "Return as a monadic value the derivation for OS according to ACTION."
 | 
				
			||||||
  (case action
 | 
					  (case action
 | 
				
			||||||
    ((build init reconfigure)
 | 
					    ((build init reconfigure)
 | 
				
			||||||
| 
						 | 
					@ -578,7 +579,8 @@ PATTERN, a string.  When PATTERN is #f, display all the system generations."
 | 
				
			||||||
                                                (* 70 (expt 2 20)))
 | 
					                                                (* 70 (expt 2 20)))
 | 
				
			||||||
                                            #:mappings mappings))
 | 
					                                            #:mappings mappings))
 | 
				
			||||||
    ((disk-image)
 | 
					    ((disk-image)
 | 
				
			||||||
     (system-disk-image os #:disk-image-size image-size))))
 | 
					     (system-disk-image os #:disk-image-size image-size
 | 
				
			||||||
 | 
					                           #:file-system-type file-system-type))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (maybe-suggest-running-guix-pull)
 | 
					(define (maybe-suggest-running-guix-pull)
 | 
				
			||||||
  "Suggest running 'guix pull' if this has never been done before."
 | 
					  "Suggest running 'guix pull' if this has never been done before."
 | 
				
			||||||
| 
						 | 
					@ -610,13 +612,15 @@ and TARGET arguments."
 | 
				
			||||||
                         #:key install-bootloader?
 | 
					                         #:key install-bootloader?
 | 
				
			||||||
                         dry-run? derivations-only?
 | 
					                         dry-run? derivations-only?
 | 
				
			||||||
                         use-substitutes? device target
 | 
					                         use-substitutes? device target
 | 
				
			||||||
                         image-size full-boot?
 | 
					                         image-size file-system-type full-boot?
 | 
				
			||||||
                         (mappings '())
 | 
					                         (mappings '())
 | 
				
			||||||
                         (gc-root #f))
 | 
					                         (gc-root #f))
 | 
				
			||||||
  "Perform ACTION for OS.  INSTALL-BOOTLOADER? specifies whether to install
 | 
					  "Perform ACTION for OS.  INSTALL-BOOTLOADER? specifies whether to install
 | 
				
			||||||
bootloader; DEVICE is the target devices for bootloader; TARGET is the target
 | 
					bootloader; DEVICE is the target devices for bootloader; TARGET is the target
 | 
				
			||||||
root directory; IMAGE-SIZE is the size of the image to be built, for the
 | 
					root directory; IMAGE-SIZE is the size of the image to be built, for the
 | 
				
			||||||
'vm-image' and 'disk-image' actions.  FULL-BOOT? is used for the 'vm' action;
 | 
					'vm-image' and 'disk-image' actions.
 | 
				
			||||||
 | 
					The root filesystem is created as a FILE-SYSTEM-TYPE filesystem.
 | 
				
			||||||
 | 
					FULL-BOOT? is used for the 'vm' action;
 | 
				
			||||||
it determines whether to boot directly to the kernel or to the bootloader.
 | 
					it determines whether to boot directly to the kernel or to the bootloader.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
When DERIVATIONS-ONLY? is true, print the derivation file name(s) without
 | 
					When DERIVATIONS-ONLY? is true, print the derivation file name(s) without
 | 
				
			||||||
| 
						 | 
					@ -632,6 +636,7 @@ output when building a system derivation, such as a disk image."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  (mlet* %store-monad
 | 
					  (mlet* %store-monad
 | 
				
			||||||
      ((sys       (system-derivation-for-action os action
 | 
					      ((sys       (system-derivation-for-action os action
 | 
				
			||||||
 | 
					                                                #:file-system-type file-system-type
 | 
				
			||||||
                                                #:image-size image-size
 | 
					                                                #:image-size image-size
 | 
				
			||||||
                                                #:full-boot? full-boot?
 | 
					                                                #:full-boot? full-boot?
 | 
				
			||||||
                                                #:mappings mappings))
 | 
					                                                #:mappings mappings))
 | 
				
			||||||
| 
						 | 
					@ -774,6 +779,10 @@ Some ACTIONS support additional ARGS.\n"))
 | 
				
			||||||
  (display (G_ "
 | 
					  (display (G_ "
 | 
				
			||||||
      --on-error=STRATEGY
 | 
					      --on-error=STRATEGY
 | 
				
			||||||
                         apply STRATEGY when an error occurs while reading FILE"))
 | 
					                         apply STRATEGY when an error occurs while reading FILE"))
 | 
				
			||||||
 | 
					  (display (G_ "
 | 
				
			||||||
 | 
					      --file-system-type=TYPE
 | 
				
			||||||
 | 
					                         for 'disk-image', produce a root file system of TYPE
 | 
				
			||||||
 | 
					                         (one of 'ext4', 'iso9660')"))
 | 
				
			||||||
  (display (G_ "
 | 
					  (display (G_ "
 | 
				
			||||||
      --image-size=SIZE  for 'vm-image', produce an image of SIZE"))
 | 
					      --image-size=SIZE  for 'vm-image', produce an image of SIZE"))
 | 
				
			||||||
  (display (G_ "
 | 
					  (display (G_ "
 | 
				
			||||||
| 
						 | 
					@ -812,6 +821,10 @@ Some ACTIONS support additional ARGS.\n"))
 | 
				
			||||||
                 (lambda (opt name arg result)
 | 
					                 (lambda (opt name arg result)
 | 
				
			||||||
                   (alist-cons 'on-error (string->symbol arg)
 | 
					                   (alist-cons 'on-error (string->symbol arg)
 | 
				
			||||||
                               result)))
 | 
					                               result)))
 | 
				
			||||||
 | 
					         (option '(#\t "file-system-type") #t #f
 | 
				
			||||||
 | 
					                 (lambda (opt name arg result)
 | 
				
			||||||
 | 
					                   (alist-cons 'file-system-type arg
 | 
				
			||||||
 | 
					                               result)))
 | 
				
			||||||
         (option '("image-size") #t #f
 | 
					         (option '("image-size") #t #f
 | 
				
			||||||
                 (lambda (opt name arg result)
 | 
					                 (lambda (opt name arg result)
 | 
				
			||||||
                   (alist-cons 'image-size (size->number arg)
 | 
					                   (alist-cons 'image-size (size->number arg)
 | 
				
			||||||
| 
						 | 
					@ -854,6 +867,7 @@ Some ACTIONS support additional ARGS.\n"))
 | 
				
			||||||
    (build-hook? . #t)
 | 
					    (build-hook? . #t)
 | 
				
			||||||
    (max-silent-time . 3600)
 | 
					    (max-silent-time . 3600)
 | 
				
			||||||
    (verbosity . 0)
 | 
					    (verbosity . 0)
 | 
				
			||||||
 | 
					    (file-system-type . "ext4")
 | 
				
			||||||
    (image-size . guess)
 | 
					    (image-size . guess)
 | 
				
			||||||
    (install-bootloader? . #t)))
 | 
					    (install-bootloader? . #t)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -906,6 +920,7 @@ resulting from command-line parsing."
 | 
				
			||||||
                             #:derivations-only? (assoc-ref opts
 | 
					                             #:derivations-only? (assoc-ref opts
 | 
				
			||||||
                                                            'derivations-only?)
 | 
					                                                            'derivations-only?)
 | 
				
			||||||
                             #:use-substitutes? (assoc-ref opts 'substitutes?)
 | 
					                             #:use-substitutes? (assoc-ref opts 'substitutes?)
 | 
				
			||||||
 | 
					                             #:file-system-type (assoc-ref opts 'file-system-type)
 | 
				
			||||||
                             #:image-size (assoc-ref opts 'image-size)
 | 
					                             #:image-size (assoc-ref opts 'image-size)
 | 
				
			||||||
                             #:full-boot? (assoc-ref opts 'full-boot?)
 | 
					                             #:full-boot? (assoc-ref opts 'full-boot?)
 | 
				
			||||||
                             #:mappings (filter-map (match-lambda
 | 
					                             #:mappings (filter-map (match-lambda
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue