unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* using shepherd's (shepherd service repl) in guix system
@ 2023-12-21 14:46 Justin Veilleux
  2024-01-09 22:36 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Justin Veilleux @ 2023-12-21 14:46 UTC (permalink / raw)
  To: guix-devel

Hi. I thought it would be interesting to have a shepherd service run a
repl like in
https://www.gnu.org/software/shepherd/manual/html_node/REPL-Service.html.
Since there is no shepherd repl service in a (gnu services *) module, I
created a shepherd-service-type and shepherd-service (I copied the code
from `(shepherd service repl)`)

The `reconfigure` runs and after fiddling with permission bits and
connecting to the socket through emacs and geiser (like in the manual),
I am able to execute expressions such as `(+ 2 2)` and `(display
"test\n")` and everything works as expected.

However, when I try to evaluate `lookup-service` (without calling it),
the repl gets stuck in an infinite loop of

> scheme@(shepherd-user) [1]> While reading expression:
> Attempt to suspend fiber within continuation barrier

This is annoying, since inspecting the state of shepherd is my main use
case for the REPL service. Has anyone encountered this problem?

The `shepherd-repl-service-type`:

> (define shepherd-repl-service-type
>   (service-type
>    (name 'shepherd-repl)
>    (description "Run a shepherd repl")
>    (default-value "/var/run/shepherd/repl")
>    (extensions
>     (list
>      (service-extension
>       shepherd-root-service-type
>       (lambda (socket-file)
>         (list
>          (shepherd-service
>           (documentation "Run the shepherd repl")
>           (provision '(repl))
>           (requirement '())
>           (start #~(lambda args
>                      (format #t "socket file: ~s\n" #$socket-file)
>                      (with-exception-handler
>                          (lambda (exn)
>                            #f)
>                        (lambda ()
>                          (delete-file #$socket-file))
>                        #:unwind? #t)
>                      (let ((socket (open-server-socket #$socket-file)))
>                        ((@@ (shepherd service repl) spawn-repl-service) socket)
>                        socket)))
>           (stop #~(lambda (socket)
>                     (close-port socket)
>                     #f))
>           (modules (cons*
>                     '(shepherd service repl)
>                     '(shepherd comm)
>                     %default-modules))))))))))


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

end of thread, other threads:[~2024-01-11  9:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-21 14:46 using shepherd's (shepherd service repl) in guix system Justin Veilleux
2024-01-09 22:36 ` Ludovic Courtès
2024-01-11  9:26   ` Andy Wingo

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