Hi Thijs, Sorry for the late reply.
Thijs <thijs@ouroboros.rocks> writes: > I am wondering if it possible for Shepherd to load services using a > guix package. > `herd load root </absolute/path/to/service-with-guix-package.scm>` > > I tried variations on > ``` > (define-module (testd) > #:use-module (guix gexp) > #:use-module (shepherd service) > #:use-module (gnu packages ssh)) > > (define testd > (service > '(sshd ssh-daemon) ;multiple names > #:start (make-forkexec-constructor > (list (file-append openssh "/sbin/sshd") "-D") > #:pid-file "/tmp/sshd.pid") > #:stop (make-kill-destructor) > #:respawn? #t)) > (register-services (list testd)) > ``` > but I never manage to start the sshd service. When you ‘herd load root’ the file above, ‘shepherd’ (PID 1) ends up loading the (guix gexp) and (gnu packages ssh) modules from Guix; it’s halfway turning your init system into a package manager. :-) However… > I get errors (after loading) like: >> Loading > > /mnt/data/engagement/networking/Ouroboros/tools/ouroboros/.guix/modules/ouroboros/testd.scm. >> herd: error: exception caught while executing 'load' on service 'root': >> no code for module (gcrypt hash) … some modules needed by those Guix modules are not visible in ‘GUILE_LOAD_PATH’ for ‘shepherd’. In this case, the (gcrypt hash) module from Guile-Gcrypt, which Guix depends on, is not visible, so loading (guix gexp) fails. There’s another issue: even if ‘shepherd’ managed to load all these modules (which would be possible by adjusting its ‘GUILE_LOAD_PATH’ and ‘GUILE_LOAD_COMPILED_PATH’ environment variables), the ‘make-forkexec-constructor’ expects a list of strings as its first argument, but (file-append openssh …) does *not* return a string—it returns a <file-append> record, and that leads to a type error. HTH! Ludo’.