unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#49430] [PATCH] doc: Add auto login to tty guide to the cookbook.
@ 2021-07-06  6:20 Joshua Branson via Guix-patches via
  2021-07-06  6:56 ` Leo Prikler
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Joshua Branson via Guix-patches via @ 2021-07-06  6:20 UTC (permalink / raw)
  To: 49430; +Cc: Joshua Branson, leo.prikler

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 3482 bytes --]

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
 
 
 @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
 
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#49430] [PATCH] doc: Add auto login to tty guide to the cookbook.
  2021-07-06  6:20 [bug#49430] [PATCH] doc: Add auto login to tty guide to the cookbook Joshua Branson via Guix-patches via
@ 2021-07-06  6:56 ` Leo Prikler
  2021-07-06  7:58   ` Joshua Branson via Guix-patches via
  2021-07-06  8:08 ` Joshua Branson via Guix-patches via
  2021-07-07  1:39 ` [bug#49430] [PATCH] doc: Add auto login a user to a specific " Joshua Branson via Guix-patches via
  2 siblings, 1 reply; 7+ messages in thread
From: Leo Prikler @ 2021-07-06  6:56 UTC (permalink / raw)
  To: Joshua Branson, 49430; +Cc: Joshua Branson

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#49430] [PATCH] doc: Add auto login to tty guide to the cookbook.
  2021-07-06  6:56 ` Leo Prikler
@ 2021-07-06  7:58   ` Joshua Branson via Guix-patches via
  0 siblings, 0 replies; 7+ messages in thread
From: Joshua Branson via Guix-patches via @ 2021-07-06  7:58 UTC (permalink / raw)
  To: Leo Prikler; +Cc: Joshua Branson, 49430


I'll do some edits and update the patch.  Thanks for the suggestions!

-- 
Joshua Branson (joshuaBPMan in #guix)
Sent from Emacs and Gnus
  https://gnucode.me
  https://video.hardlimit.com/accounts/joshua_branson/video-channels
  https://propernaming.org
  "You can have whatever you want, as long as you help
enough other people get what they want." - Zig Ziglar
  




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#49430] [PATCH] doc: Add auto login to tty guide to the cookbook.
  2021-07-06  6:20 [bug#49430] [PATCH] doc: Add auto login to tty guide to the cookbook Joshua Branson via Guix-patches via
  2021-07-06  6:56 ` Leo Prikler
@ 2021-07-06  8:08 ` Joshua Branson via Guix-patches via
  2021-07-06  8:58   ` Leo Prikler
  2021-07-07  1:39 ` [bug#49430] [PATCH] doc: Add auto login a user to a specific " Joshua Branson via Guix-patches via
  2 siblings, 1 reply; 7+ messages in thread
From: Joshua Branson via Guix-patches via @ 2021-07-06  8:08 UTC (permalink / raw)
  To: 49430; +Cc: Joshua Branson, leo.prikler

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 3172 bytes --]

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 | 45 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi
index 1cddaa7faf..85489e1a93 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 a User to a Specific TTY::   Automatically Login a User to a Specific TTY
 
 
 @end detailmenu
@@ -1353,6 +1354,7 @@ chapter is to demonstrate some advanced configuration concepts.
 reference.
 
 @menu
+* Auto Login a User to a Specific TTY::   Automatically Login a User to a Specific 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,47 @@ reference.
 * Setting up NGINX with Lua:: Configuring NGINX web-server to load Lua modules.
 @end menu
 
+@node Auto Login a User to a Specific TTY
+@section Auto Login a User to a Specific 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" "alice"))))
+
+(operating-system
+    (host-name "antelope")
+    ...
+    (services
+     (append
+      (list (service dhcp-client-service-type))
+      %my-base-services)))
+@end lisp
+
+Note that the above code will automatically login the user @code{alice}
+into @code{tty3}. 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.
+
+
 @node Customizing the Kernel
 @section Customizing the Kernel
 
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#49430] [PATCH] doc: Add auto login to tty guide to the cookbook.
  2021-07-06  8:08 ` Joshua Branson via Guix-patches via
@ 2021-07-06  8:58   ` Leo Prikler
  0 siblings, 0 replies; 7+ messages in thread
From: Leo Prikler @ 2021-07-06  8:58 UTC (permalink / raw)
  To: Joshua Branson, 49430; +Cc: Joshua Branson

Hi,

this looks a bit better, but a few things remain, that irk me.
Am Dienstag, den 06.07.2021, 04:08 -0400 schrieb Joshua Branson:
> From: Joshua Branson <jbranso@gnucode.me>
> 
> * doc/guix-cookbook.texi (System Configuration): Add a brief guide
> explaining mingetty auto-login.
I think the commit message is better written as above instead of what
you had.
> ---
>  doc/guix-cookbook.texi | 45
> +++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 44 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi
> index 1cddaa7faf..85489e1a93 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 a User to a Specific TTY::   Automatically Login a User
> to a Specific TTY
>  
>  
>  @end detailmenu
> @@ -1353,6 +1354,7 @@ chapter is to demonstrate some advanced
> configuration concepts.
>  reference.
>  
>  @menu
> +* Auto Login a User to a Specific TTY::   Automatically Login a User
> to a Specific TTY
I'm not a fan of this breaking the columns, but perhaps it's necessary.
>  * 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,47 @@ reference.
>  * Setting up NGINX with Lua:: Configuring NGINX web-server to load
> Lua modules.
>  @end menu
>  
> +@node Auto Login a User to a Specific TTY
> +@section Auto Login a User to a Specific 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
Note, that mingetty is not the only service offering auto-login. 
Basically all terminals and DMs have one.
Also "a newcomer" → "newcomers" may be more appropriate in that it
doesn't single anyone out, though in my personal opinion "newcomer" has
some "only grade schoolers play on easy modo" vibes attached to it,
particularly within a manual/cookbook.

Perhaps to soften this, you should open up stating "While the Guix
manual explains how to login a user to *all* TTYs, some might prefer a
situation, in which one user is logged in to one TTY with the other
TTYs either configured to login different users or no one at all."
> +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"
> "alice"))))
I'd inline this definition below in services
> +(operating-system
> +    (host-name "antelope")
> +    ...
> +    (services
> +     (append
> +      (list (service dhcp-client-service-type))
Replace this by a comment ";; additional services you might want, e.g"
followed by the commented service list.
> +      %my-base-services)))
> +@end lisp
Follow up with how one can compose auto-login-to-tty to login multiple
users to multiple TTYs (no full system config needed here, just the
mention of compose).

Finally, though this is very personal, I'd put the note of caution from
before here at the end, because now the reader has a complete
understanding of what it is, that they are achieving.  Putting the
warning in the front might scare them away into not trying – which
would be a security win for sure – but it could also happen, that they
just skip over the warning and copypasta the code.  Having everything
together at the bottom is therefore preferable in my personal opinion,
though again, that's very personal and others might disagree here.

> +Note that the above code will automatically login the user
> @code{alice}
> +into @code{tty3}. 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.
The explanation that alice is logged into tty3 is probably apparent
from the procedure call, so putting the explanation of avoiding TTY1
among the caveats above has priority over when to explain, that alice
is logged in to tty3.  Still, you might want to split this up, so that
the former goes in front of the explanation on how to login multiple
users and the latter to the caveats.

Regards,
Leo





^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#49430] [PATCH] doc: Add auto login a user to a specific tty guide to the cookbook.
  2021-07-06  6:20 [bug#49430] [PATCH] doc: Add auto login to tty guide to the cookbook Joshua Branson via Guix-patches via
  2021-07-06  6:56 ` Leo Prikler
  2021-07-06  8:08 ` Joshua Branson via Guix-patches via
@ 2021-07-07  1:39 ` Joshua Branson via Guix-patches via
  2021-07-07  9:29   ` bug#49430: " Leo Prikler
  2 siblings, 1 reply; 7+ messages in thread
From: Joshua Branson via Guix-patches via @ 2021-07-07  1:39 UTC (permalink / raw)
  To: 49430; +Cc: Joshua Branson, leo.prikler

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 5648 bytes --]

From: Joshua Branson <jbranso@gnucode.me>

* doc/guix-cookbook.texi (System Configuration): Add a brief guide that
explains auto login a user to one TTY.  This is a follow up to bug 48974.

* doc/guix.texi (System Services): Add an texinfo anchor, so that the cookbook
entry "Auto Login a User to a Specific TTY" can refer back to the precise
point that the GNU Guix Reference manual.  Also add a reference to the
cookbook that shows how to auto login a specific user to one TTY.
---
 doc/guix-cookbook.texi | 58 +++++++++++++++++++++++++++++++++++++++++-
 doc/guix.texi          | 13 ++++++----
 2 files changed, 65 insertions(+), 6 deletions(-)

diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi
index 1cddaa7faf..a9c3ef6407 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 a User to a Specific TTY::   Automatically Login a User to a Specific TTY
 
 
 @end detailmenu
@@ -1353,6 +1354,7 @@ chapter is to demonstrate some advanced configuration concepts.
 reference.
 
 @menu
+* Auto Login a User to a Specific TTY::   Automatically Login a User to a Specific 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,60 @@ reference.
 * Setting up NGINX with Lua:: Configuring NGINX web-server to load Lua modules.
 @end menu
 
+@node Auto Login a User to a Specific TTY
+@section Auto Login a User to a Specific TTY
+
+While the Guix manual explains auto-login one user to @emph{all} TTYs (
+@pxref{auto-login to TTY,,, guix, GNU Guix Reference Manual}), some
+might prefer a situation, in which one user is logged into one TTY with
+the other TTYs either configured to login different users or no one at
+all.  Note that one can auto-login one user to any TTY, but it is
+usually advisable to avoid @code{tty1}, which, by default, is used to
+log warnings and errors.
+
+Here is how one might set up auto login for one user to one tty:
+
+@lisp
+(use-modules (gnu) (guix))
+(use-service-modules avahi networking xorg)
+
+(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" "alice"))))
+
+(operating-system
+    (host-name "antelope")
+    ...
+    (services
+     (append
+      (list
+       ;; additional services you might want, e.g
+       ;; (service avahi-service-type)
+       ;; (service gdm-service-type)
+       (service dhcp-client-service-type))
+      %my-base-services)))
+@end lisp
+
+One could also @code{compose} (@pxref{Higher-Order Functions,,, guile,
+The Guile Reference Manual}) @code{auto-login-to-tty} to login multiple
+users to multiple ttys.
+
+Finally, here is 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 to a TTY
+is a secure and convenient option for you.
+
+
 @node Customizing the Kernel
 @section Customizing the Kernel
 
diff --git a/doc/guix.texi b/doc/guix.texi
index 1086d3220b..0410225196 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -13542,10 +13542,11 @@ Occasionally, instead of using the base services as is, you will want to
 customize them.  To do this, use @code{modify-services} (@pxref{Service
 Reference, @code{modify-services}}) to modify the list.
 
-For example, suppose you want to modify @code{guix-daemon} and Mingetty
-(the console log-in) in the @code{%base-services} list (@pxref{Base
-Services, @code{%base-services}}).  To do that, you can write the
-following in your operating system declaration:
+@anchor{auto-login to TTY} For example, suppose you want to modify
+@code{guix-daemon} and Mingetty (the console log-in) in the
+@code{%base-services} list (@pxref{Base Services,
+@code{%base-services}}).  To do that, you can write the following in
+your operating system declaration:
 
 @lisp
 (define %my-services
@@ -13571,7 +13572,9 @@ following in your operating system declaration:
 
 This changes the configuration---i.e., the service parameters---of the
 @code{guix-service-type} instance, and that of all the
-@code{mingetty-service-type} instances in the @code{%base-services} list.
+@code{mingetty-service-type} instances in the @code{%base-services} list
+(@pxref{Auto Login a User to a Specific TTY, see the cookbook for how to
+auto-login one user to a specific TTY,, guix-cookbook, GNU Guix Cookbook})).
 Observe how this is accomplished: first, we arrange for the original
 configuration to be bound to the identifier @code{config} in the
 @var{body}, and then we write the @var{body} so that it evaluates to the
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#49430: [PATCH] doc: Add auto login a user to a specific tty guide to the cookbook.
  2021-07-07  1:39 ` [bug#49430] [PATCH] doc: Add auto login a user to a specific " Joshua Branson via Guix-patches via
@ 2021-07-07  9:29   ` Leo Prikler
  0 siblings, 0 replies; 7+ messages in thread
From: Leo Prikler @ 2021-07-07  9:29 UTC (permalink / raw)
  To: Joshua Branson, 49430-done; +Cc: Joshua Branson

I've pushed your code with some slight cosmetic changes, which I'll
list below to master.

- I changed the title of the section to easier fit into a menu.
- I changed the example to mimic the one given in the manual
- I rephrased the bit about encrypted root.

Note, that applying the patch was a bit of a pain, as your send-email
setup appears to set the following:

Content-Type: text/plain; charset=y

Please use UTF-8 in the future ;P

Also, I'll probably receive a mail in a few hours stating that <
jbranso@gnucode.me> can not be reached.  Does this mail really satisfy
the conditions one would typically have for having it in AUTHORS?

Regards,
Leo

Am Dienstag, den 06.07.2021, 21:39 -0400 schrieb Joshua Branson:
> From: Joshua Branson <jbranso@gnucode.me>
> 
> * doc/guix-cookbook.texi (System Configuration): Add a brief guide
> that
> explains auto login a user to one TTY.  This is a follow up to bug
> 48974.
> 
> * doc/guix.texi (System Services): Add an texinfo anchor, so that the
> cookbook
> entry "Auto Login a User to a Specific TTY" can refer back to the
> precise
> point that the GNU Guix Reference manual.  Also add a reference to
> the
> cookbook that shows how to auto login a specific user to one TTY.
> ---
>  doc/guix-cookbook.texi | 58
> +++++++++++++++++++++++++++++++++++++++++-
>  doc/guix.texi          | 13 ++++++----
>  2 files changed, 65 insertions(+), 6 deletions(-)
> 
> diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi
> index 1cddaa7faf..a9c3ef6407 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 a User to a Specific TTY::   Automatically Login a User
> to a Specific TTY
>  
>  
>  @end detailmenu
> @@ -1353,6 +1354,7 @@ chapter is to demonstrate some advanced
> configuration concepts.
>  reference.
>  
>  @menu
> +* Auto Login a User to a Specific TTY::   Automatically Login a User
> to a Specific 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,60 @@ reference.
>  * Setting up NGINX with Lua:: Configuring NGINX web-server to load
> Lua modules.
>  @end menu
>  
> +@node Auto Login a User to a Specific TTY
> +@section Auto Login a User to a Specific TTY
> +
> +While the Guix manual explains auto-login one user to @emph{all}
> TTYs (
> +@pxref{auto-login to TTY,,, guix, GNU Guix Reference Manual}), some
> +might prefer a situation, in which one user is logged into one TTY
> with
> +the other TTYs either configured to login different users or no one
> at
> +all.  Note that one can auto-login one user to any TTY, but it is
> +usually advisable to avoid @code{tty1}, which, by default, is used
> to
> +log warnings and errors.
> +
> +Here is how one might set up auto login for one user to one tty:
> +
> +@lisp
> +(use-modules (gnu) (guix))
> +(use-service-modules avahi networking xorg)
> +
> +(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" "alice"))))
> +
> +(operating-system
> +    (host-name "antelope")
> +    ...
> +    (services
> +     (append
> +      (list
> +       ;; additional services you might want, e.g
> +       ;; (service avahi-service-type)
> +       ;; (service gdm-service-type)
> +       (service dhcp-client-service-type))
> +      %my-base-services)))
> +@end lisp
> +
> +One could also @code{compose} (@pxref{Higher-Order Functions,,,
> guile,
> +The Guile Reference Manual}) @code{auto-login-to-tty} to login
> multiple
> +users to multiple ttys.
> +
> +Finally, here is 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 to a
> TTY
> +is a secure and convenient option for you.
> +
> +
>  @node Customizing the Kernel
>  @section Customizing the Kernel
>  
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 1086d3220b..0410225196 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -13542,10 +13542,11 @@ Occasionally, instead of using the base
> services as is, you will want to
>  customize them.  To do this, use @code{modify-services}
> (@pxref{Service
>  Reference, @code{modify-services}}) to modify the list.
>  
> -For example, suppose you want to modify @code{guix-daemon} and
> Mingetty
> -(the console log-in) in the @code{%base-services} list (@pxref{Base
> -Services, @code{%base-services}}).  To do that, you can write the
> -following in your operating system declaration:
> +@anchor{auto-login to TTY} For example, suppose you want to modify
> +@code{guix-daemon} and Mingetty (the console log-in) in the
> +@code{%base-services} list (@pxref{Base Services,
> +@code{%base-services}}).  To do that, you can write the following in
> +your operating system declaration:
>  
>  @lisp
>  (define %my-services
> @@ -13571,7 +13572,9 @@ following in your operating system
> declaration:
>  
>  This changes the configuration---i.e., the service parameters---of
> the
>  @code{guix-service-type} instance, and that of all the
> -@code{mingetty-service-type} instances in the @code{%base-services}
> list.
> +@code{mingetty-service-type} instances in the @code{%base-services}
> list
> +(@pxref{Auto Login a User to a Specific TTY, see the cookbook for
> how to
> +auto-login one user to a specific TTY,, guix-cookbook, GNU Guix
> Cookbook})).
>  Observe how this is accomplished: first, we arrange for the original
>  configuration to be bound to the identifier @code{config} in the
>  @var{body}, and then we write the @var{body} so that it evaluates to
> the





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-07-07  9:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06  6:20 [bug#49430] [PATCH] doc: Add auto login to tty guide to the cookbook Joshua Branson via Guix-patches via
2021-07-06  6:56 ` Leo Prikler
2021-07-06  7:58   ` Joshua Branson via Guix-patches via
2021-07-06  8:08 ` Joshua Branson via Guix-patches via
2021-07-06  8:58   ` Leo Prikler
2021-07-07  1:39 ` [bug#49430] [PATCH] doc: Add auto login a user to a specific " Joshua Branson via Guix-patches via
2021-07-07  9:29   ` bug#49430: " Leo Prikler

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).