Subject: Re: bug#48974: A possible shepherd bug (it's very minor)

From: Joshua Branson <[email-masked]>
Date: Fri, 25 Jun 2021 05:31:13 -0400

Leo Prikler <[email-masked]> writes:

> Hi,
>
> Am Samstag, den 12.06.2021, 20:09 +0000 schrieb [email-masked]:
>> June 12, 2021 3:39 PM, "Leo Prikler" <[email-masked]>
>> wrote:
>>
>> > Am Samstag, den 12.06.2021, 09:26 -0400 schrieb Joshua Branson:
>> >
>> > > Hello!
>> > >
>> I'll tell you what, why don't we leave this "bug" open for a
>> week...I'll try to write
>> the code that does what I want, and I'll email the answer.
>>
>> Then I'll edit the manual to provide an example!
> I'm pretty sure that the actual bug also exists, just not sure whether
> that's on your config or on shepherd.  Using TTY1 for graphical stuff
> is also somewhat rare in Guix land, I presume.  (Or rather, I can't
> think of it as anything but a container for debug output spam :D)
>
> As for getting this to work only on TTY1, you do get the config object,
> so you can do stuff like
>   (if (is-tty1? config) (inherit+autologin config) config)
> Note of course, that is-tty1? is not a procedure that's ready-made, but
> one that you'd need to build from primitives such as record accessors.
>

Well, it's been about a week. Here is my current code that doesn't work.
haha.

#+BEGIN_SRC scheme
(define %my-desktop-services
  (modify-services %desktop-services ;;end of remove services
    (mingetty-service-type config =>
                           (mingetty-configuration
                            (inherit config)
                            ;; ERROR at the NEXT LINE
                            (auto-login-to-tty-3 config)
                            ))))

(define (auto-login-to-tty-3 config)
  (if (string=? "3" (mingetty-configuration-tty config))
      '(auto-login "joshua")
      '(auto-login #f)))
#+END_SRC

It obviously doesn't work because I am treating modify-services as if it
were a procedure.  In fact, it is a macro.  :)

I'm just popping in to give you an update on my progress.  I've probably
spent less than 20 minutes working on this.  The good news is I did find
the record accessor for tty is mingetty-configuration-tty.

My goal for the next week is to do something like this:

#+BEGIN_SRC scheme
(define (auto-login-to-tty-3 mingetty-service)
  (if (string=? "3" (mingetty-configuration-tty config))
      '(mingetty-configuration
         (auto-login "joshua")
         (tty "3"))
      mingetty-service))

(define (my-modify-%desktop-services-to-auto-login-on-tty-3 %desktop-services)
   ;; to be written
   ;; though I think fold, or map, may be useful functions here.

   ;;somehow I will use this function...
    (auto-login-to-tty-3 mingetty-service)
)

(define %my-desktop-services
        (my-modify-%desktop-services-to-auto-login-on-tty-3 %desktop-services))
#+END_SRC

I'll post again in about a week to tell you about my progress!

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