aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2025-04-08 15:24:26 +0900
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2025-04-08 15:26:17 +0900
commite839cd1108626a6db6c47915f0efa4ab41c6a01c (patch)
tree415ddacb429e2abd3874060cf5bbaebcb850e520
parentc9524b5841a057b5e64abf0dca75261e741949c5 (diff)
downloadguix-e839cd1108626a6db6c47915f0efa4ab41c6a01c.tar.gz
guix-e839cd1108626a6db6c47915f0efa4ab41c6a01c.zip
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
-rw-r--r--doc/guix.texi9
-rw-r--r--gnu/services/messaging.scm57
2 files changed, 37 insertions, 29 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 70371ad212..f7868422f7 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -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
diff --git a/gnu/services/messaging.scm b/gnu/services/messaging.scm
index 67dadf493e..6a3569aa4c 100644
--- a/gnu/services/messaging.scm
+++ b/gnu/services/messaging.scm
@@ -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.")))