From patchwork Tue Jul 6 06:20:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joshua Branson X-Patchwork-Id: 31187 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9547427BC81; Tue, 6 Jul 2021 07:21:17 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1807427BC78 for ; Tue, 6 Jul 2021 07:21:17 +0100 (BST) Received: from localhost ([::1]:58108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0eSK-0002Uu-4A for patchwork@mira.cbaines.net; Tue, 06 Jul 2021 02:21:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0eS6-0002Um-Rt for guix-patches@gnu.org; Tue, 06 Jul 2021 02:21:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35555) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m0eS6-0007Mh-K4 for guix-patches@gnu.org; Tue, 06 Jul 2021 02:21:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m0eS6-0003fj-6P for guix-patches@gnu.org; Tue, 06 Jul 2021 02:21:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49430] [PATCH] doc: Add auto login to tty guide to the cookbook. Resent-From: Joshua Branson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 06 Jul 2021 06:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49430 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49430@debbugs.gnu.org Cc: Joshua Branson , leo.prikler@student.tugraz.at X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162555243414060 (code B ref -1); Tue, 06 Jul 2021 06:21:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Jul 2021 06:20:34 +0000 Received: from localhost ([127.0.0.1]:47101 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0eRe-0003eh-4Y for submit@debbugs.gnu.org; Tue, 06 Jul 2021 02:20:34 -0400 Received: from lists.gnu.org ([209.51.188.17]:45586) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0eRb-0003eZ-Pz for submit@debbugs.gnu.org; Tue, 06 Jul 2021 02:20:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0eRb-0002SD-Jz for guix-patches@gnu.org; Tue, 06 Jul 2021 02:20:31 -0400 Received: from mx1.dismail.de ([78.46.223.134]:4899) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0eRW-0006iP-GN for guix-patches@gnu.org; Tue, 06 Jul 2021 02:20:31 -0400 Received: from mx1.dismail.de (localhost [127.0.0.1]) by mx1.dismail.de (OpenSMTPD) with ESMTP id abda4549; Tue, 6 Jul 2021 08:20:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=dismail.de; h=from:to:cc :subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=20190914; bh=Rf5zTgybScI0N/lVilxMq 4oZV+5qRQVlL9lk0guT4h4=; b=g1tHUcuRLcRRxF9FWuFyoEIhGx+61y5cCCRZh wyrWmqC/LzyLq6U1M98qPP1wfdEeKpOs+lNWVC4jFFWTHH/VNNVrrdYPajWrO34g RMLnbAZ6LnY04Cui3iYwQciZ1AW07P2llXIr4lglgiVJRK5cBUaprCb0kfz5Z0RA N0AdegCC5Mc2V+RyOciKs/V4SKcIg1roL3/nnCH+CO+V54+A5s65JeBtG5LoCCxn yxMyarQ9+3ukP/hho5U/2b7AzDdDqxLh/FF9u1HbQGk7tXqPVKFadmPLnv+efIbk DwBREbqz3CDQlMCgs8Hq7/i3L5a0k1VEqlLQt1ixrSbEF35Ng== Received: from smtp1.dismail.de ( [10.240.26.11]) by mx1.dismail.de (OpenSMTPD) with ESMTP id e208d87d; Tue, 6 Jul 2021 08:20:20 +0200 (CEST) Received: from smtp1.dismail.de (localhost [127.0.0.1]) by smtp1.dismail.de (OpenSMTPD) with ESMTP id 344575d3; Tue, 6 Jul 2021 08:20:20 +0200 (CEST) Received: by dismail.de (OpenSMTPD) with ESMTPSA id 8c624c91 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Tue, 6 Jul 2021 08:20:18 +0200 (CEST) Date: Tue, 6 Jul 2021 02:20:04 -0400 Message-Id: <20210706062004.24820-1-jbranso@dismail.de> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Received-SPF: pass client-ip=78.46.223.134; envelope-from=jbranso@dismail.de; helo=mx1.dismail.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Joshua Branson X-ACL-Warn: , Joshua Branson via Guix-patches X-Patchwork-Original-From: Joshua Branson via Guix-patches via From: Joshua Branson X-getmail-retrieved-from-mailbox: Patches From: Joshua Branson * doc/guix-cookbook.texi (System Configuration): Add a brief guide that explains auto login to a TTY. This is a follow up to bug 48974. --- doc/guix-cookbook.texi | 59 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi index 1cddaa7faf..47f8d60ade 100644 --- a/doc/guix-cookbook.texi +++ b/doc/guix-cookbook.texi @@ -17,6 +17,7 @@ Copyright @copyright{} 2020 Marcin Karpezo@* Copyright @copyright{} 2020 Brice Waegeneire@* Copyright @copyright{} 2020 André Batista@* Copyright @copyright{} 2020 Christopher Lemmer Webber +Copyright @copyright{} 2021 Joshua Branson@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -85,7 +86,7 @@ Packaging System Configuration -* Customizing the Kernel:: Creating and using a custom Linux kernel +* Auto Login to TTY:: Set up auto login via a TTY @end detailmenu @@ -1353,6 +1354,7 @@ chapter is to demonstrate some advanced configuration concepts. reference. @menu +* Auto Login to TTY:: Set up auto login via a TTY. * Customizing the Kernel:: Creating and using a custom Linux kernel on Guix System. * Guix System Image API:: Customizing images to target specific platforms. * Connecting to Wireguard VPN:: Connecting to a Wireguard VPN. @@ -1363,6 +1365,61 @@ reference. * Setting up NGINX with Lua:: Configuring NGINX web-server to load Lua modules. @end menu +@node Auto Login to TTY +@section Auto Login to TTY + +Guix System currently offers auto login to a tty via @code{mingetty}, +but a newcomer to Guix System may be unfamiliar with setting up auto +login. First, a note of caution. Setting up auto login to a tty, means +that anyone can turn on your computer and run commands as your regular +user. If you have encrypted your @code{/} partition, and thus need to +enter in a passphrase at boot, then perhaps auto login is a secure and +convenient option for you. + +Here is how one might go about setting up auto login to a tty: + +@lisp +(define (auto-login-to-tty config tty user) + (if (string=? tty (mingetty-configuration-tty config)) + (mingetty-configuration + (inherit config) + (auto-login user)) + config)) + +(define %my-base-services + (modify-services %base-services + (mingetty-service-type config => + (auto-login-to-tty config "tty3" "joshua")))) + +(operating-system + (host-name "dobby") + ... + (services + (append + (list (service dhcp-client-service-type)) + %my-base-services))) +@end lisp + +Note that the above code automatically logs the user into @code{tty3}. +Any TTY will work, though perhaps it is best not to use @code{tty1}, +which is reserved for error messages. + +You could also start your graphical environment via your +@code{~/.bash_profile}. Here is an example script to auto start the +sway window manager: + +@example shell +# Honor per-interactive-shell startup file +if [ -f ~/.bashrc ]; then . ~/.bashrc; fi + +if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty3 ]]; then + exec dbus-run-session sway +fi +@end example + +When Guix Home is merged, the above bash script may be replaced by a +@code{home.scm} file. + @node Customizing the Kernel @section Customizing the Kernel