summaryrefslogtreecommitdiff
path: root/gnu/services
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2021-10-12 16:50:47 +0000
committerMathieu Othacehe <othacehe@gnu.org>2021-10-12 17:46:23 +0000
commita1eca979fb8da842e73c42f4f53be29b169810f2 (patch)
tree681c7283e412bb8a29c2531c4408b49c3e184764 /gnu/services
parent48d86a9ec6d8d2e97da2299ea41a03ef4cdaab83 (diff)
parent371aa5777a3805a3886f3feea5f1960fe3fe4219 (diff)
Merge remote-tracking branch 'origin/master' into core-updates-frozen.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/configuration.scm90
-rw-r--r--gnu/services/dns.scm4
-rw-r--r--gnu/services/ganeti.scm4
-rw-r--r--gnu/services/sound.scm2
-rw-r--r--gnu/services/web.scm3
5 files changed, 94 insertions, 9 deletions
diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index df3d3b6f9b..e8c55b6e4d 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -25,10 +26,12 @@
#:use-module (guix records)
#:use-module (guix gexp)
#:use-module ((guix utils) #:select (source-properties->location))
- #:use-module ((guix diagnostics) #:select (location-file))
+ #:use-module ((guix diagnostics) #:select (formatted-message location-file))
#:use-module ((guix modules) #:select (file-name->module-name))
+ #:use-module (guix i18n)
#:autoload (texinfo) (texi-fragment->stexi)
#:autoload (texinfo serialize) (stexi->texi)
+ #:use-module (ice-9 curried-definitions)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-34)
@@ -56,7 +59,20 @@
generate-documentation
configuration->documentation
empty-serializer
- serialize-package))
+ serialize-package
+
+ filter-configuration-fields
+
+ interpose
+ list-of
+
+ list-of-strings?
+ alist?
+ serialize-file-like
+ text-config?
+ serialize-text-config
+ generic-serialize-alist-entry
+ generic-serialize-alist))
;;; Commentary:
;;;
@@ -323,3 +339,73 @@ Texinfo documentation of its fields."
'-fields))))
(display (generate-documentation `((,configuration-symbol ,fields-getter))
configuration-symbol))))
+
+(define* (filter-configuration-fields configuration-fields fields
+ #:optional negate?)
+ "Retrieve the fields listed in FIELDS from CONFIGURATION-FIELDS.
+If NEGATE? is @code{#t}, retrieve all fields except FIELDS."
+ (filter (lambda (field)
+ (let ((member? (member (configuration-field-name field) fields)))
+ (if (not negate?) member? (not member?))))
+ configuration-fields))
+
+
+(define* (interpose ls #:optional (delimiter "\n") (grammar 'infix))
+ "Same as @code{string-join}, but without join and string, returns an
+DELIMITER interposed LS. Support 'infix and 'suffix GRAMMAR values."
+ (when (not (member grammar '(infix suffix)))
+ (raise
+ (formatted-message
+ (G_ "The GRAMMAR value must be 'infix or 'suffix, but ~a provided.")
+ grammar)))
+ (fold-right (lambda (e acc)
+ (cons #~(begin
+ (use-modules (ice-9 rdelim))
+ (with-fluids ((%default-port-encoding "UTF-8"))
+ (with-input-from-file #$e read-string)))
+ (if (and (null? acc) (eq? grammar 'infix))
+ acc
+ (cons delimiter acc))))
+ '() ls))
+
+(define (list-of pred?)
+ "Return a procedure that takes a list and check if all the elements of
+the list result in @code{#t} when applying PRED? on them."
+ (lambda (x)
+ (if (list? x)
+ (every pred? x)
+ #f)))
+
+
+(define list-of-strings?
+ (list-of string?))
+
+(define alist? list?)
+
+(define serialize-file-like empty-serializer)
+
+(define (text-config? config)
+ (list-of file-like?))
+(define (serialize-text-config field-name val)
+ #~(string-append #$@(interpose val "\n" 'suffix)))
+
+(define ((generic-serialize-alist-entry serialize-field) entry)
+ "Apply the SERIALIZE-FIELD procedure on the field and value of ENTRY."
+ (match entry
+ ((field . val) (serialize-field field val))))
+
+(define (generic-serialize-alist combine serialize-field fields)
+ "Generate a configuration from an association list FIELDS.
+
+SERIALIZE-FIELD is a procedure that takes two arguments, it will be
+applied on the fields and values of FIELDS using the
+@code{generic-serialize-alist-entry} procedure.
+
+COMBINE is a procedure that takes one or more arguments and combines
+all the alist entries into one value, @code{string-append} or
+@code{append} are usually good candidates for this.
+
+See the @code{serialize-alist} procedure in `@code{(gnu home services
+version-control}' for an example usage.)}"
+ (apply combine
+ (map (generic-serialize-alist-entry serialize-field) fields)))
diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm
index aeb2bfdc86..93055eba38 100644
--- a/gnu/services/dns.scm
+++ b/gnu/services/dns.scm
@@ -185,8 +185,6 @@
(default '()))
(semantic-checks? knot-zone-configuration-semantic-checks?
(default #f))
- (disable-any? knot-zone-configuration-disable-any?
- (default #f))
(zonefile-sync knot-zone-configuration-zonefile-sync
(default 0))
(zonefile-load knot-zone-configuration-zonefile-load
@@ -509,7 +507,6 @@
(notify (list #$@(knot-zone-configuration-notify zone)))
(acl (list #$@(knot-zone-configuration-acl zone)))
(semantic-checks? #$(knot-zone-configuration-semantic-checks? zone))
- (disable-any? #$(knot-zone-configuration-disable-any? zone))
(zonefile-sync #$(knot-zone-configuration-zonefile-sync zone))
(zonefile-load '#$(knot-zone-configuration-zonefile-load zone))
(journal-content #$(knot-zone-configuration-journal-content zone))
@@ -541,7 +538,6 @@
#$(format-string-list
(knot-zone-configuration-acl zone))))
(format #t " semantic-checks: ~a\n" (if semantic-checks? "on" "off"))
- (format #t " disable-any: ~a\n" (if disable-any? "on" "off"))
(if zonefile-sync
(format #t " zonefile-sync: ~a\n" zonefile-sync))
(if zonefile-load
diff --git a/gnu/services/ganeti.scm b/gnu/services/ganeti.scm
index 0a34ea6a5e..ef22d1a331 100644
--- a/gnu/services/ganeti.scm
+++ b/gnu/services/ganeti.scm
@@ -612,7 +612,11 @@ provide the collected information through a HTTP interface.")))
(documentation "Run the Ganeti metadata daemon.")
(provision '(ganeti-metad))
(requirement '(user-processes networking))
+
+ ;; This service is started on demand.
+ (auto-start? #f)
(respawn? #f)
+
(start #~(make-forkexec-constructor
(list #$(file-append ganeti "/sbin/ganeti-metad")
#$(string-append "--port=" (number->string port))
diff --git a/gnu/services/sound.scm b/gnu/services/sound.scm
index bdf819b422..55610f27e0 100644
--- a/gnu/services/sound.scm
+++ b/gnu/services/sound.scm
@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018, 2020 Oleg Pykhalov <go.wigust@gmail.com>
-;;; Copyright © 2020 Leo Prikler <leo.prikler@student.tugraz.at>
+;;; Copyright © 2020 Liliana Marie Prikler <liliana.prikler@gmail.com>
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
;;;
;;; This file is part of GNU Guix.
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 6a093cf4e4..bb42eacf83 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -3,11 +3,10 @@
;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Nikita <nikita@n0.is>
;;; Copyright © 2016, 2017, 2018 Julien Lepiller <julien@lepiller.eu>
-;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
+;;; Copyright © 2017, 2018, 2019 Christopher Baines <mail@cbaines.net>
;;; Copyright © 2017 nee <nee-git@hidamari.blue>
;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby@inria.fr>
-;;; Copyright © 2017, 2018, 2019 Christopher Baines <mail@cbaines.net>
;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2019, 2020 Florian Pelz <pelzflorian@pelzflorian.de>
;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>