guix/gnu/services
Xinglu Chen 2ad896751c
services: configuration: Allow specifying prefix for serializer names.
Sometimes two configurations might have the same types for their field values,
but the values might be serialized in two completely different
ways (e.g. because the two programs have different configuration languages).

An example of this would be the ‘serialize-boolean’ procedure in (gnu services
mail) and (gnu services getmail).  They both serialize a boolean value, but
because the Dovecot’s configuration language has a different syntax to the
configuration language for Getmail, two different procedures have to be
defined.

One way to workaround this would be to specify custom serializers for many
fields in order to separate the serialization of the values that have the same
type but serialize in different ways.  This could get very tedious, especially
if there are many configurations in the same module.

Another way would be to move one of the configurations to its own module, like
what was done with (gnu services getmail).  However, this would mean that
there would be multiple modules containing configurations for related
programs, e.g. we have (gnu services mail) and (gnu services getmail), it
doesn’t make much sense to keep the Getmail configuration in its own module.

This patch will allow one to write something like this:

  (define-configuration foo-configuration
    (bar
      (string "bob")
      "Option bar.")
    (prefix bar-))

and the value of the ‘bar’ field would be serialized using a procedure named
‘bar-serialize-string’ instead of just ‘serialize-string’.

* gnu/services/configuration.scm (define-maybe-helper): Accept ‘prefix’
argument for using serializer with custom prefix.
(define-maybe): Pattern match on ‘prefix’ literal.
(define-configuration-helper): Accept ‘prefix’ argument for using serializer
with custom prefix.
(define-configuration): Pattern match on ‘prefix’ literal.
* tests/services/configuration.scm ("serialize-configuration with prefix"):
New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-06-29 12:37:33 +02:00
..
admin.scm services: rottlog: Add /var/log/mcron.log to '%default-rotations'. 2021-03-29 23:33:41 +02:00
audio.scm
auditd.scm
authentication.scm services: Prevent following symlinks during activation. 2021-03-10 18:01:47 +01:00
avahi.scm services: Remove deprecated service procedures. 2021-06-14 18:35:17 +02:00
base.scm services: guix: Authorize 'bordeaux.guix.gnu.org.pub' by default. 2021-06-19 09:32:54 +01:00
certbot.scm services: certbot: Add option to use CSR file. 2021-06-24 18:19:39 -04:00
cgit.scm
ci.scm services: laminar: Create parent directory for unix socket. 2021-06-10 09:58:20 +05:30
configuration.scm services: configuration: Allow specifying prefix for serializer names. 2021-06-29 12:37:33 +02:00
cuirass.scm services: cuirass: Do not export record type descriptors. 2021-06-01 23:26:07 +02:00
cups.scm services: cups: Remove obsolete KeepAliveTimeout directive. 2021-06-23 03:26:33 +02:00
databases.scm services: mysql: Add extra-environment as configuration option. 2021-04-27 20:45:35 +02:00
dbus.scm services: Prevent following symlinks during activation. 2021-03-10 18:01:47 +01:00
desktop.scm services: Remove deprecated service procedures. 2021-06-14 18:35:17 +02:00
dict.scm
dns.scm services: dnsmasq: Extend 'activation-service'. 2021-05-31 22:06:54 +02:00
docker.scm services: docker: Disable configuration serialization. 2021-05-08 01:04:31 -04:00
file-sharing.scm services: Add transmission-daemon service. 2021-02-12 15:11:36 +08:00
games.scm
ganeti.scm
getmail.scm
guix.scm services: guix-build-coordinator: Fix queue builds state directory. 2021-05-02 09:56:42 +01:00
herd.scm
hurd.scm
kerberos.scm
linux.scm services: Add a service for rasdaemon. 2021-04-24 12:30:01 -04:00
lirc.scm
mail.scm services: dovecot: Add ‘managesieve-sieve-capability’ option. 2021-05-06 11:31:48 +02:00
mcron.scm services: Remove deprecated service procedures. 2021-06-14 18:35:17 +02:00
messaging.scm services: Remove deprecated service procedures. 2021-06-14 18:35:17 +02:00
monitoring.scm
networking.scm services: Remove deprecated service procedures. 2021-06-14 18:35:17 +02:00
nfs.scm gnu: services: Fix the NFS service. 2021-02-05 17:19:10 -05:00
nix.scm services: nix: Add /bin/sh to build-sandbox-paths. 2021-04-26 20:03:55 +03:00
pam-mount.scm
pm.scm
rsync.scm
science.scm
sddm.scm
security-token.scm services: pcscd: Cleanup socket when started. 2021-06-19 23:49:18 +02:00
shepherd.scm services: shepherd: Make 'assert-valid-graph' public. 2021-03-03 14:19:26 +01:00
sound.scm
spice.scm services: spice-vdagent: Clear the socket file prior to starting. 2021-05-06 16:51:49 -04:00
ssh.scm services: openssh: Replace 'without-password' by 'prohibit-password'. 2021-06-20 16:44:08 +02:00
syncthing.scm
sysctl.scm services: sysctl: Export <sysctl-configuration> record field accessors. 2021-03-31 15:36:49 +02:00
telephony.scm
version-control.scm services: git-daemon: Fix typo in docstring. 2021-04-10 14:11:26 +02:00
virtualization.scm services/qemu-binfmt: Use the F flag and the static output of QEMU. 2021-03-15 18:00:35 -04:00
vpn.scm Remove unused module imports from (gnu services vpn). 2021-06-25 13:27:10 +02:00
web.scm gnu: services: web: Have fcgiwrap log to a file. 2021-04-01 09:01:52 +01:00
xorg.scm services: Remove deprecated service procedures. 2021-06-14 18:35:17 +02:00