~ruther/guix-local

e839cd1108626a6db6c47915f0efa4ab41c6a01c — Maxim Cournoyer 1 year, 3 months ago c9524b5
services: Add a default configuration value for the ngircd service.

* gnu/services/messaging.scm (ngircd-configuration): Adjust comment.
(ngircd-wrapper): Nest bindings within the (maybe-value-set? ssl) check, to
avoid errors when not providing an explicit value to the ssl field.
(ngircd-service-type) [default-value]: New field.

Change-Id: I1d2d7973cc9314e9bbc5870bf7b5f872d074b49b
2 files changed, 37 insertions(+), 29 deletions(-)

M doc/guix.texi
M gnu/services/messaging.scm
M doc/guix.texi => doc/guix.texi +8 -1
@@ 30363,7 30363,14 @@ server.
The service type for ngIRCd.  Its value is a @code{ngircd-configuration}
object, documented below.

A simple example configuration could look like:
In its most simple form, the service can be used with its default
configuration, like this:

@lisp
(service ngircd-service-type)
@end lisp

A slightly more complex example configuration could look like:

@lisp
(service ngircd-service-type

M gnu/services/messaging.scm => gnu/services/messaging.scm +29 -28
@@ 1416,8 1416,8 @@ for different users.  Refer to @samp{man 5 ngircd.conf} for more details.")
   "Turn on debugging messages."
   (serializer empty-serializer))
  (global
   ;; Always use a ngircd-global default to ensure the correct PidFile option
   ;; is set, as it is required by the service.
   ;; Always use a ngircd-global default to ensure the default addresses
   ;; listened to are known (used to compute the socket endpoints).
   (ngircd-global (ngircd-global))
   "A ngircd-global record object used to specify global options.")
  (limits


@@ 1515,10 1515,6 @@ wrapper for the 'ngircd' command."
         (help-file (ngircd-global-help-file global))
         (motd-file (ngircd-global-motd-file global))
         (ssl (ngircd-configuration-ssl config))
         (ca-file (ngircd-ssl-ca-file ssl))
         (cert-file (ngircd-ssl-cert-file ssl))
         (key-file (ngircd-ssl-key-file ssl))
         (dh-file (ngircd-ssl-dh-file ssl))
         (channels (ngircd-configuration-channels config)))
    (least-authority-wrapper
     (file-append (ngircd-configuration-ngircd config) "/sbin/ngircd")


@@ 1545,28 1541,32 @@ wrapper for the 'ngircd' command."
                 (target source)))
          '())
      (if (maybe-value-set? ssl)
          ;; When SSL is used, expose the specified keys and certificates.
          (append
           (if (maybe-value-set? ca-file)
               (list (file-system-mapping
                      (source ca-file)
                      (target source)))
               '())
           (if (maybe-value-set? cert-file)
               (list (file-system-mapping
                      (source cert-file)
                      (target source)))
               '())
           (if (maybe-value-set? key-file)
               (list (file-system-mapping
                      (source key-file)
                      (target source)))
               '())
           (if (maybe-value-set? dh-file)
               (list (file-system-mapping
                      (source dh-file)
                      (target source)))
               '()))
          (let ((ca-file (ngircd-ssl-ca-file ssl))
                (cert-file (ngircd-ssl-cert-file ssl))
                (key-file (ngircd-ssl-key-file ssl))
                (dh-file (ngircd-ssl-dh-file ssl)))
            ;; When SSL is used, expose the specified keys and certificates.
            (append
             (if (maybe-value-set? ca-file)
                 (list (file-system-mapping
                        (source ca-file)
                        (target source)))
                 '())
             (if (maybe-value-set? cert-file)
                 (list (file-system-mapping
                        (source cert-file)
                        (target source)))
                 '())
             (if (maybe-value-set? key-file)
                 (list (file-system-mapping
                        (source key-file)
                        (target source)))
                 '())
             (if (maybe-value-set? dh-file)
                 (list (file-system-mapping
                        (source dh-file)
                        (target source)))
                 '())))
          '())
      (if (maybe-value-set? channels)
          (filter-map (lambda (channel)


@@ 1631,6 1631,7 @@ wrapper for the 'ngircd' command."
                             (compose list ngircd-configuration-ngircd))
          (service-extension account-service-type
                             ngircd-account)))
   (default-value (ngircd-configuration))
   (description
    "Run @url{https://ngircd.barton.de/, ngIRCd}, a lightweight @acronym{IRC,
Internet Relay Chat} daemon.")))