guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#49430] [PATCH] doc: Add auto login to tty guide to the cookbook.


From: Leo Prikler
Subject: [bug#49430] [PATCH] doc: Add auto login to tty guide to the cookbook.
Date: Tue, 06 Jul 2021 08:56:48 +0200
User-agent: Evolution 3.34.2

Am Dienstag, den 06.07.2021, 02:20 -0400 schrieb Joshua Branson:
> From: Joshua Branson <jbranso@gnucode.me>
> 
> * 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
This should somehow indicate that it's auto-login to a *particular*
TTY, rather than to all TTYs as in the manual.
>  
>  @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)))
Rather than "joshua@dobby" I think we should pick one of the animals
that's widely used in the manual for host-name and alice for the user.
> +@end lisp
> +
> +Note that the above code automatically logs the user into
> @code{tty3}.
Spell out alice.
> +Any TTY will work, though perhaps it is best not to use @code{tty1},
> +which is reserved for error messages.
I'm not too sure about the "reserved" bit, because you can absolutely
pass TTY1 (the install disk uses it for the ncurses UI, for example). 
So I'd rather rephrase this as
"You can auto-login your user to any TTY, though it's usually advisable
to avoid @code{tty1}, as by default it is used to log warnings and
errors." 

> +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.
> +
This bit is slightly too specific and no longer about logging a user in
to a TTY.  When Guix Home is merged and there is an appropriate
@file{home.scm} to show here, that'll be fine (or even good, if it's
one of the first practical examples of Guix Home in the cookbook), but
the thing this currently advertises looks like a bit of a hack.

I'm somewhat sure, that sway users will intuitively find the `exec
dbus-run-session sway` hack on their own -- if not, it ought to be
documented as a part of sway, not Guix.

WDYT?
Leo






reply via email to

[Prev in Thread] Current Thread [Next in Thread]