From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QJhGLDR4pmF/OQAAgWs5BA (envelope-from ) for ; Tue, 30 Nov 2021 20:15:00 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id WNDXJzR4pmH6HwAAB5/wlQ (envelope-from ) for ; Tue, 30 Nov 2021 19:15:00 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 53C252D2DC for ; Tue, 30 Nov 2021 20:15:00 +0100 (CET) Received: from localhost ([::1]:39812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ms8ag-0002Iz-QV for larch@yhetil.org; Tue, 30 Nov 2021 14:14:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ms8Zm-0002EO-BT for guix-patches@gnu.org; Tue, 30 Nov 2021 14:14:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59223) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ms8Zm-0003mu-31 for guix-patches@gnu.org; Tue, 30 Nov 2021 14:14:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ms8Zl-0007vD-V6 for guix-patches@gnu.org; Tue, 30 Nov 2021 14:14:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#52204] [PATCH] guix system vm: Add --no-graphic CLI argument. Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 30 Nov 2021 19:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 52204 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 52204@debbugs.gnu.org Cc: Attila Lendvai X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.163829963630431 (code B ref -1); Tue, 30 Nov 2021 19:14:01 +0000 Received: (at submit) by debbugs.gnu.org; 30 Nov 2021 19:13:56 +0000 Received: from localhost ([127.0.0.1]:42536 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ms8Zf-0007ul-PG for submit@debbugs.gnu.org; Tue, 30 Nov 2021 14:13:56 -0500 Received: from lists.gnu.org ([209.51.188.17]:40990) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ms8ZQ-0007uN-4X for submit@debbugs.gnu.org; Tue, 30 Nov 2021 14:13:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ms8ZP-0001xi-Os for guix-patches@gnu.org; Tue, 30 Nov 2021 14:13:39 -0500 Received: from [2a00:1450:4864:20::331] (port=34677 helo=mail-wm1-x331.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ms8ZN-0003j7-T0 for guix-patches@gnu.org; Tue, 30 Nov 2021 14:13:39 -0500 Received: by mail-wm1-x331.google.com with SMTP id m25-20020a7bcb99000000b0033aa12cdd33so8272686wmi.1 for ; Tue, 30 Nov 2021 11:13:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=P+Y/VGXHK+/CsDWZkprCrsAqfiYGvQQ7q3DexgEJo60=; b=M2wrlRIGScc+noargdPtGGUf9T3us3TyDu6dtZp/2kd5YWSlSW5DreKOVZZydHqPTf cWgyjXorfU+MHhfn9wHxGKLfMLCoCuPEk3IeiRxkR/TtOnDUljNihY7UTmGG4veUon7u SZKNUus2iTpAyAchy5Orrg4U9enHSbYoBU0FEVNQNVdo6bBDtS+ykldN0QKNoIkqVRn7 2UAyXCd9CMDJ52gFQ9mFLYramugu/wt1eNEd/lDJ/BF+4KYMcEw2aAcbDvfUZjBJ3GbV hzFwBt+JTpxx0SQYWUrsSwd6Cjt3957OgGpCT+nm40aRY9urYCJCpBTB+ys9RQC9LACv i5BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=P+Y/VGXHK+/CsDWZkprCrsAqfiYGvQQ7q3DexgEJo60=; b=YWli/987L50eiFDvOCOkhGMsB1LG9i2a/A0biyC/8f2leMBv4IqEyMoQAAT5BZtX4B 0T+r+zwjReD5JYE/7nm9gZtJZM40f9A5TdwofAAo8XHzQkbLAqD5Q6ocZGbl9IRHtV4G 5r8hPQ7q449ECo/3qARzRK5+l5kS0rMqmJ7QSwNxhj5523k1L1/XeMCM0QlmT+u+ZI4q 0ZxMWE0s6Vo2DFoK9ezF9PYqhV6J6vYxPncodZdU4VyGfL1sUBZa+FPiwzXQkj/dIi/i 6TvQL+uz9rutud5kGCrUSL0yxMlP2o4hlY0+zN27VMBFI/MmS2q9No5W6POp873wIlHS AZtQ== X-Gm-Message-State: AOAM53083t9G0feSlr8o4HhKKdhrIfsacAXHxq5UVTzTuIALlwaotOQD ySUQ3fnqngKeHNej7mM5ansDw4FSz8I2Og== X-Google-Smtp-Source: ABdhPJyypnj7pDPxnOByjPi1+3hCJKhzI1Mdq+MC0VAs4Syl6vGzHrq5vz9ankdilsfAO/Rw/R6oWA== X-Received: by 2002:a7b:c844:: with SMTP id c4mr732603wml.148.1638299615960; Tue, 30 Nov 2021 11:13:35 -0800 (PST) Received: from lelap.lan (catv-89-132-208-37.catv.broadband.hu. [89.132.208.37]) by smtp.gmail.com with ESMTPSA id r15sm3108329wmh.13.2021.11.30.11.13.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Nov 2021 11:13:35 -0800 (PST) From: Attila Lendvai Date: Tue, 30 Nov 2021 20:13:13 +0100 Message-Id: <20211130191312.32131-1-attila@lendvai.name> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::331 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=attila.lendvai@gmail.com; helo=mail-wm1-x331.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1638299700; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=P+Y/VGXHK+/CsDWZkprCrsAqfiYGvQQ7q3DexgEJo60=; b=ro4/TJrAiYJCOqAfitrQ9OZgXlEx9YTprBJ6SbWn4fCdWG7TxPSFRV1DiH6uc/VG6ywSVA /Gn2A65fihzdjqQ6v0ZeF1vrltaRHj3yBAI5Ox7VhJctJpobKKBTEBf3FXkvm7jN4y4jsA lVMZc3Bnolqsh9Dmcy0jmYBdjK+qVM+TnHtf+w1Ve0Ltuwh4SL0R77tDu4aFlMY/XxTpHr R65cYu565IkK8Ds61rAAPf7Bz7gK54SZxtBRbMw3CzCTT6zq2brhOqpmCt7o+Mh46DboiC pDBXWOrUQG827EfRDi43iQdvaQDQeHX9yc5B7oacITDROlDMoQPkJ0VbLFrrIA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1638299700; a=rsa-sha256; cv=none; b=CK1d938HLQ1cpMXVZDpY2xBLCh0FChHJQVGftgF+g9uuxifHKWhkp7qX8NE8DepZyErMS+ ZtAi/lxfA2AmceSfuqvAxs7zjXRxVMe2m62T6+sr6+Pmd1XQX5k5ww6378oaemP6pLbGqL jQ2FJc+htgGYIF4/RLzaQS62vYdYPbaJt4RMoxJ8jKHww3SDDO32NgCeoF4a6Q1mQU9Aq5 +fz5bvmxP1AF8VD7LyBEYesDhlN3fZAZdGY4Wm7KwVj3A2vkyfuvKdVx/EkoytB3o9SNJV R0g2hjbX5N3J+hOCgVVFqRygD8RyE6ANHCgfeBqee8OxEiLLqh5K97+YRGm5Ag== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=M2wrlRIG; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.29 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=M2wrlRIG; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 53C252D2DC X-Spam-Score: -1.29 X-Migadu-Scanner: scn0.migadu.com X-TUID: NfXrELyKSo8L 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. --- gnu/system/vm.scm | 2 ++ guix/scripts/system.scm | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 1e2d8b47c2..0a95302584 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -754,6 +754,8 @@ (define kernel-arguments (define qemu-exec #~(list #+(file-append qemu "/bin/" (qemu-command (or target system))) + ;; Tells qemu to use the terminal it was started in for IO. + #$@(if graphic? '() #~("-nographic")) #$@(if full-boot? #~() #~("-kernel" #$(operating-system-kernel-file os) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 7faa92fd7d..1675fccf50 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -689,6 +689,7 @@ (define file-systems (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 @@ (define* (system-derivation-for-action image action ((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 @@ (define* (perform-action action image dry-run? derivations-only? use-substitutes? target full-boot? + (graphic? #t) container-shared-network? (mappings '()) (gc-root #f)) @@ -825,6 +828,7 @@ (define bootcfg (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 @@ (define (show-help) 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 @@ (define %options (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 @@ (define (graph-backend) #:validate-reconfigure (assoc-ref opts 'validate-reconfigure) #:full-boot? (assoc-ref opts 'full-boot?) + #:graphic? (if (assoc-ref opts 'no-graphic?) #f #t) #:container-shared-network? (assoc-ref opts 'container-shared-network?) #:mappings (filter-map (match-lambda -- 2.33.0