[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
using shepherd's (shepherd service repl) in guix system
From: |
Justin Veilleux |
Subject: |
using shepherd's (shepherd service repl) in guix system |
Date: |
Thu, 21 Dec 2023 09:46:21 -0500 |
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))))))))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- using shepherd's (shepherd service repl) in guix system,
Justin Veilleux <=