guix system vm: Add --no-graphic CLI argument.

It configures QEMU to use the tty it was started in for IO (as opposed to
opening a separate graphical window).  This enables copy-pasting and
scrollback.  Exit QEMU with C-a x.

* gnu/system/vm.scm (system-qemu-image/shared-store-script): Also add the
'-nographic' QEMU argument when called with #:graphic? #false.
* guix/scripts/system.scm (system-derivation-for-action): Propagate
the #:graphic? keyword arg.
(perform-action): Add and propagate the #:graphic? keyword arg.
(show-help): Add --no-graphic CLI arg.
(%options): Process the new --no-graphic CLI arg.
(process-action): Feed in the CLI arg through the #:graphic? keyword arg.
* doc/guix.texi (Invoking guix system): Add example to combine guix system and
invoking the vm start script into one command.  Split the description of the
various options into separate paragraphs.  Add a paragraph to describe
--no-graphic.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
This commit is contained in:
Attila Lendvai 2021-12-02 20:18:56 +01:00 committed by Mathieu Othacehe
parent 5a18cf3604
commit b42bfbdfe5
No known key found for this signature in database
GPG key ID: 8354763531769CA6
3 changed files with 31 additions and 4 deletions

View file

@ -689,6 +689,7 @@ checking this by themselves in their 'check' procedure."
(define* (system-derivation-for-action image action
#:key
full-boot?
(graphic? #t)
container-shared-network?
mappings)
"Return as a monadic value the derivation for IMAGE according to ACTION."
@ -706,6 +707,7 @@ checking this by themselves in their 'check' procedure."
((vm)
(system-qemu-image/shared-store-script os
#:full-boot? full-boot?
#:graphic? graphic?
#:disk-image-size
(if full-boot?
image-size
@ -772,6 +774,7 @@ and TARGET arguments."
dry-run? derivations-only?
use-substitutes? target
full-boot?
(graphic? #t)
container-shared-network?
(mappings '())
(gc-root #f))
@ -825,6 +828,7 @@ static checks."
(mlet* %store-monad
((sys (system-derivation-for-action image action
#:full-boot? full-boot?
#:graphic? graphic?
#:container-shared-network? container-shared-network?
#:mappings mappings))
@ -1012,6 +1016,8 @@ Some ACTIONS support additional ARGS.\n"))
register it as a garbage collector root"))
(display (G_ "
--full-boot for 'vm', make a full boot sequence"))
(display (G_ "
--no-graphic for 'vm', use the tty that we are started in for IO"))
(display (G_ "
--skip-checks skip file system and initrd module safety checks"))
(display (G_ "
@ -1081,6 +1087,9 @@ Some ACTIONS support additional ARGS.\n"))
(option '("full-boot") #f #f
(lambda (opt name arg result)
(alist-cons 'full-boot? #t result)))
(option '("no-graphic") #f #f
(lambda (opt name arg result)
(alist-cons 'no-graphic? #t result)))
(option '("save-provenance") #f #f
(lambda (opt name arg result)
(alist-cons 'save-provenance? #t result)))
@ -1266,6 +1275,7 @@ resulting from command-line parsing."
#:validate-reconfigure
(assoc-ref opts 'validate-reconfigure)
#:full-boot? (assoc-ref opts 'full-boot?)
#:graphic? (not (assoc-ref opts 'no-graphic?))
#:container-shared-network?
(assoc-ref opts 'container-shared-network?)
#:mappings (filter-map (match-lambda