guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: modular shepherd config


From: Maxim Cournoyer
Subject: Re: modular shepherd config
Date: Tue, 14 Apr 2020 00:46:21 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hello Efraim,

Efraim Flashner <address@hidden> writes:

> A while ago I split my personal shepherd init.scm into a bunch of files
> and I wanted to document it somewhere for others to see also. Any
> suggestion where I should put it? Shepherd manual? guix-cookbook?

Since this is purely about organizing Shepherd services (with nothing
specific about Guix), I'd add this to the Shepherd manual; then perhaps
link to it from other places if relevant.

> (ins)efraim@E5400 ~$ tree .config/shepherd/
> .config/shepherd/
> ├── init.d
> │   ├── dropbox.scm
> │   ├── fccache.scm
> │   ├── gnupg.scm
> │   ├── guix.scm
> │   ├── kdeconnect.scm
> │   ├── mbsync.scm
> │   ├── syncthing.scm
> │   └── vdirsyncer.scm
> ├── init.scm
> └── shepherd.log
>
> (ins)efraim@E5400 ~$ cat .config/shepherd/init.scm
> (use-modules (shepherd service)
>              ((ice-9 ftw) #:select (scandir)))
>
> ;; Load all the files in the directory 'init.d' with a suffix '.scm'.
> (for-each
>   (lambda (file)
>     (load (string-append "init.d/" file)))
>   (scandir (string-append (dirname (current-filename)) "/init.d")
>            (lambda (file)
>              (string-suffix? ".scm" file))))
>
> ;; Send shepherd into the background
> (action 'shepherd 'daemonize)

Don't you also need to register the services and arrange to have them
started?

My init.scm looks like:

--8<---------------cut here---------------start------------->8---
;;; Shepherd User Services
(load "services.scm")

(register-services
 emacs
 gpg-agent
 jackd
 ibus-daemon
 workrave)

;; Send shepherd into the background.
(action 'shepherd 'daemonize)

;; Services to start when shepherd starts:
(for-each start '(emacs
                  gpg-agent
                  ibus-daemon
                  workrave))
--8<---------------cut here---------------end--------------->8---

Thanks for sharing!

Maxim



reply via email to

[Prev in Thread] Current Thread [Next in Thread]