Commit Graph

17 Commits

Author SHA1 Message Date
Bruno Victal a7994ed58d
services: configuration: Use transducers within serialize-configuration.
Introduces 'base-transducer', a SRFI-171 based transducer that can be used as a
starting point for writing custom configuration record serializing procedures.

This also fixes the symbol maybe-value serialization test case.

* gnu/services/configuration.scm (empty-serializer?): New predicate.
(base-transducer, tfilter-maybe-value): New procedure.
(serialize-configuration): Adapt to use base-transducer.

* gnu/services/telephony.scm (jami-account->alist): Use transducers to skip
fields that are unserializable or whose field maybe-value is unset.

* tests/services/configuration.scm: Remove test-expect-fail.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2023-10-07 12:41:05 -04:00
Maxim Cournoyer aef75942fc
gnu: libjami: Move jamid daemon to a "bin" output.
* gnu/packages/jami.scm (libjami) [outputs]: Add a "bin" output.
[arguments]: Add a move-jamid phase.
* gnu/services/telephony.scm
(jami-configuration->command-line-arguments): Refer to the "bin" output of
libjami.
(jami-shepherd-services): Likewise.
2023-02-08 09:36:26 -05:00
Maxim Cournoyer effdc6c83e
services: jami-service-type: Streamline stop slot.
* gnu/services/telephony.scm (jami-shepherd-services)
[stop]: Use make-kill-destructor with SIGKILL.  Add comment.
2022-09-23 23:56:16 -04:00
Attila Lendvai ee08277a70
services: Use the new maybe/unset API.
* gnu/home/services/ssh.scm (serialize-address-family): Use the public API of
the maybe infrastructure.
* gnu/services/file-sharing.scm (serialize-maybe-string): Use maybe-value.
(serialize-maybe-file-object): Use maybe-value-set?.
* gnu/services/getmail.scm (getmail-retriever-configuration): Don't use
internals in unset field declarations.
(getmail-destination-configuration): Ditto.
* gnu/services/messaging.scm (raw-content?): Use maybe-value-set?.
(prosody-configuration): Use %unset-value.
* gnu/services/telephony.scm (jami-shepherd-services): Use maybe-value-set?.
(archive-name->username): Use maybe-value-set?.
* tests/services/configuration.scm ("maybe type, no default"): Use
%unset-value.

Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-08-25 00:10:32 -04:00
Maxim Cournoyer a2b89a3319
services: configuration: Step back from *unspecified*.
Fixes <https://issues.guix.gnu.org/56799>.

This partially reverts 8cb1a49a39.

Rationale: *unspecified* cannot be serialized thus used as a G-Expression
input, which is problematic/inconvenient when using deeply nested records.  As
an example, jami-service-type was broken when using partially defined
<jami-account> records.

* gnu/services/configuration.scm (define-maybe-helper): Check against the
'unset symbol.
(normalize-field-type+def): Adjust value to 'unset.
(define-configuration-helper): Use 'unset as the default value thunk.
* gnu/services/file-sharing.scm (serialize-maybe-string): Check against the
'unset symbol.
(serialize-maybe-file-object): Likewise.
* gnu/services/messaging.scm (define-all-configurations): Use 'unset as
value.
(raw-content?): Check against 'unset symbol.
(prosody-configuration)[http-max-content-size]: Default to 'unset.
[http-external-url]: Likewise.
[mod-muc]: Likewise.
[raw-content]: Likewise.
* gnu/services/networking.scm (opendht-configuration): Adjust documentation.
* gnu/services/telephony.scm (jami-shepherd-services): Replace *undefined*
with the 'unset symbol.
* tests/services/configuration.scm ("maybe type, no default"): Check against
the 'unset symbol.
* doc/guix.texi: Regenerate the opendht-configuration,
openvpn-client-configuration and openvpn-server-configuration documentation.
2022-08-01 12:49:35 -04:00
Attila Lendvai 8cb1a49a39
services: configuration: Use *unspecified* instead of 'disabled.
Use *unspecified* as a marker for field values that have not been set.

Rationale: 'disabled may easily clash with user values for boolean fields, is
confusing (i.e. its meaning is *not* boolean false, but unspecified) and it
also passes silently through the symbol? predicate of a field of type symbol.

* gnu/services/configuration.scm (configuration-missing-default-value):
Renamed from configuration-no-default-value.
(define-maybe-helper): Use *unspecified* instead of 'disabled, and make
the default value optional.
* gnu/home/services/desktop.scm (home-redshift-configuration):
Change (maybe-xyz 'disabled) to maybe-xyz.
* gnu/services/authentication.scm (nslcd-configuration): Likewise.
* gnu/services/cgit.scm (repository-cgit-configuration): Likewise.
* gnu/services/file-sharing.scm (serialize-maybe-string)
(serialize-maybe-file-object): Use 'unspecified?' instead of (eq? val
'disabled).
* gnu/services/messaging.scm (raw-content?): Likewise.
(ssl-configuration): Change (maybe-xyz 'disabled) to maybe-xyz.
(prosody-configuration): Likewise.
* gnu/services/file-sharing.scm (transmission-daemon-configuration):
Likewise.
* gnu/services/messaging.scm (define-all-configurations):
Use *unspecified* instead of 'disabled'.
* gnu/services/networking.scm (opendht-configuration): Likewise.
* gnu/services/pm.scm (tlp-configuration): Likewise.
* gnu/services/telephony.scm (jami-account): Likewise.
(jami-configuration): Likewise.
* gnu/services/vpn.scm (openvpn-client-configuration): Likewise.
* tests/services/configuration.scm ("maybe type, no default")
("maybe type, with default"): New tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-06-15 00:25:21 +02:00
Maxim Cournoyer 8649ac5eaa
services: jami-configuration: Rename 'jamid' field to 'libjami'.
* gnu/services/telephony.scm (gnu):
(jami-configuration)[jamid]: Rename field to...
[libjami]: ... this.
(jami-configuration->command-line-arguments): Adjust accordingly.
(jami-shepherd-services): Likewise.
2022-06-10 23:52:34 -04:00
Maxim Cournoyer 85b4dabd94
services: jami: Modernize to adjust to Shepherd 0.9+ changes.
This partially fixes <https://issues.guix.gnu.org/54786>, allowing the 'jami'
and 'jami-provisioning' system tests to pass again.

In version 0.9.0, Shepherd constructors are now run concurrently, via
cooperative scheduling (Guile Fibers).  The Jami service previously relied on
blocking sleeps while polling for D-Bus services to become ready after forking
a process; this wouldn't work anymore since while blocking the service process
wouldn't be given the chance to finish starting.  The new reliance on Fibers
in Shepherd's fork+exec-command in the helper 'send-dbus' procedure also meant
that it wouldn't work outside of Shepherd anymore.  Finally, the
'start-service' Shepherd procedure used in the test suite would cause the Jami
daemon to be spawned multiple times (a bug introduced in Shepherd 0.9.0).

To fix/simplify these problems, this change does the following:

1. Use the Guile AC/D-Bus library for D-Bus communication, which simplify
things, such as avoiding the need to fork 'dbus-send' processes.

2. The non-blocking 'sleep' version of Fiber is used for the 'with-retries'
waiting syntax.

3. A 'dbus' package variant is used to adjust the session bus configuration,
tailoring it for the use case at hand.

4. Avoid start-service in the tests, preferring 'jami-service-available?' for
now.

* gnu/build/jami-service.scm (parse-dbus-reply, strip-quotes)
(deserialize-item, serialize-boolean, dbus-dict->alist)
(dbus-array->list, parse-account-ids, parse-account-details)
(parse-contacts): Delete procedures.
(%send-dbus-binary, %send-dbus-bus, %send-dbus-user, %send-dbus-group)
(%send-dbus-debug): Delete parameters.
(jami-service-running?): New procedure.
(send-dbus/configuration-manager): Rename to...
(call-configuration-manager-method): ... this.  Turn METHOD into a positional
argument.  Turn ARGUMENTS into an optional argument.  Invoke
`call-dbus-method' instead of `send-dbus', adjusting callers accordingly.
(get-account-ids, id->account-details, id->account-details)
(id->volatile-account-details, username->id, add-account remove-account)
(username->contacts, remove-contact, add-contact, set-account-details)
(set-all-moderators, username->all-moderators?, username->moderators)
(set-moderator): Adjust accordingly.
(with-retries, send-dbus, dbus-available-services)
(dbus-service-available?): Move to ...
* gnu/build/dbus-service.scm: ... this new module.
(send-dbus): Rewrite to use the Guile AC/D-Bus library.
(%dbus-query-timeout, sleep*): New variables.
(%current-dbus-connection): New parameter.
(initialize-dbus-connection!, argument->signature-type)
(call-dbus-method): New procedures.
(dbus-available-services): Adjust accordingly.
* gnu/local.mk (GNU_SYSTEM_MODULES): Register new module.
* gnu/packages/glib.scm (dbus-for-jami): New variable.
* gnu/services/telephony.scm: (jami-configuration)[dbus]: Default to
dbus-for-jami.
(jami-dbus-session-activation): Write a D-Bus daemon configuration file at
'/var/run/jami/session-local.conf'.
(jami-shepherd-services): Add the closure of guile-ac-d-bus and guile-fibers
as extensions.  Adjust imported modules.  Remove no longer used parameters.
<jami-dbus-session>: Use a PID file, avoiding the need for the manual
synchronization.
<jami>:  Set DBUS_SESSION_BUS_ADDRESS environment variable.  Poll using
'jami-service-available?' instead of 'dbus-service-available?'.
* gnu/tests/telephony.scm (run-jami-test): Add needed Guile extensions.  Set
DBUS_SESSION_BUS_ADDRESS environment variable.  Adjust all tests to use
'jami-service-available?' to determine if the service is started rather than
the now problematic Shepherd's 'start-service'.
2022-06-10 23:52:33 -04:00
Liliana Marie Prikler 42679e3f81
services: Replace murmur-service-type with mumble-server-service-type.
* gnu/services/telephony.scm (murmur-configuration, make-murmur-configuration)
(murmur-configuration?, murmur-configuration-package)
(murmur-configuration-user, murmur-configuration-group)
(murmur-configuration-port, murmur-configuration-welcome-text)
(murmur-configuration-server-password)
(murmur-configuration-max-users)
(murmur-configuration-max-user-bandwidth)
(murmur-configuration-database-file)
(murmur-configuration-log-file, murmur-configuration-pid-file)
(murmur-configuration-autoban-attempts)
(murmur-configuration-autoban-timeframe)
(murmur-configuration-autoban-time)
(murmur-configuration-opus-threshold)
(murmur-configuration-channel-nesting-limit)
(murmur-configuration-channelname-regex)
(murmur-configuration-username-regex)
(murmur-configuration-test-message-length)
(murmur-configuration-image-message-length)
(murmur-configuration-cert-required?)
(murmur-configuration-remember-channel?)
(murmur-configuration-allow-html?)
(murmur-configuration-allow-ping?)
(murmur-configuration-bonjour?)
(murmur-configuration-send-version?)
(murmur-configuration-log-days)
(murmur-configuration-obfuscate-ips?)
(murmur-configuration-ssl-cert murmur-configuration-ssl-key)
(murmur-configuration-ssl-dh-params murmur-configuration-ssl-ciphers)
(murmur-configuration-public-registration)
(murmur-configuration-file)
(murmur-public-registration-configuration)
(make-murmur-public-registration-configuration)
(murmur-public-registration-configuration?)
(murmur-public-registration-configuration-name)
(murmur-public-registration-configuration-url)
(murmur-public-registration-configuration-password)
(murmur-public-registration-configuration-hostname)
(murmur-service-type): Add deprecation alias and rename to ...
(mumble-server-configuration, make-mumble-server-configuration)
(mumble-server-configuration?, mumble-server-configuration-package)
(mumble-server-configuration-user, mumble-server-configuration-group)
(mumble-server-configuration-port, mumble-server-configuration-welcome-text)
(mumble-server-configuration-server-password)
(mumble-server-configuration-max-users)
(mumble-server-configuration-max-user-bandwidth)
(mumble-server-configuration-database-file)
(mumble-server-configuration-log-file, mumble-server-configuration-pid-file)
(mumble-server-configuration-autoban-attempts)
(mumble-server-configuration-autoban-timeframe)
(mumble-server-configuration-autoban-time)
(mumble-server-configuration-opus-threshold)
(mumble-server-configuration-channel-nesting-limit)
(mumble-server-configuration-channelname-regex)
(mumble-server-configuration-username-regex)
(mumble-server-configuration-test-message-length)
(mumble-server-configuration-image-message-length)
(mumble-server-configuration-cert-required?)
(mumble-server-configuration-remember-channel?)
(mumble-server-configuration-allow-html?)
(mumble-server-configuration-allow-ping?)
(mumble-server-configuration-bonjour?)
(mumble-server-configuration-send-version?)
(mumble-server-configuration-log-days)
(mumble-server-configuration-obfuscate-ips?)
(mumble-server-configuration-ssl-cert mumble-server-configuration-ssl-key)
(mumble-server-configuration-ssl-dh-params) (mumble-server-configuration-ssl-ciphers)
(mumble-server-configuration-public-registration)
(mumble-server-configuration-file)
(mumble-server-public-registration-configuration)
(make-mumble-server-public-registration-configuration)
(mumble-server-public-registration-configuration?)
(mumble-server-public-registration-configuration-name)
(mumble-server-public-registration-configuration-url)
(mumble-server-public-registration-configuration-password)
(mumble-server-public-registration-configuration-hostname)
(mumble-server-service-type): ... these.
* doc/guix.texi ("Murmur (VoIP server)"): Rename to ...
("Mumble server"): ... this.  Adjust documentation accordingly.
2022-04-12 20:32:32 +02:00
fesoj000 8044a1fec9
services: murmur: Fix server program name.
* gnu/services/telephony.scm (murmur-activation):
(murmur-shepherd-service): Change file name of mumble server, which is
now called mumble-server instead of murmurd since version 1.4.x.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2022-03-24 12:45:48 +01:00
Maxim Cournoyer 374fea0f3b
services: Adjust the jami service for the upgraded jami.
* gnu/services/telephony.scm (jami-configuration)[jamid]: Rename libring to
libjami.
* gnu/services/telephony.scm
(jami-configuration->command-line-arguments): Adjust daemon file name.
* gnu/services/telephony.scm (jami-service-type): Adjust doc.
* gnu/tests/telephony.scm (run-jami-test): Check for 'jamid' process, not
'dring'.
* doc/guix.texi (Telephony Services): Adjust doc for the jami-qt to jami and
libring to libjami packages renaming.
2022-01-13 00:57:52 -05:00
Tobias Geerinckx-Rice 892f1b7273
services: Accept <inferior-package>s in lieu of <package>s.
* gnu/services/authentication.scm (fprintd-configuration)
(nslcd-configuration): Substitute file-like objects for package ones.
* gnu/services/cgit.scm (cgit-configuration, opaque-cgit-configuration):
Likewise.
* gnu/services/cups.scm (package-list?, cups-configuration): Likewise.
* gnu/services/dns.scm (verify-knot-configuration)
(ddclient-configuration): Likewise.
* gnu/services/docker.scm (docker-configuration): Likewise.
* gnu/services/file-sharing.scm (transmission-daemon-configuration): Likewise.
* gnu/services/getmail.scm (getmail-configuration): Likewise.
* gnu/services/mail.scm (dovecot-configuration)
(opaque-dovecot-configuration): Likewise.
* gnu/services/messaging.scm (prosody-configuration)
(opaque-prosody-configuration): Likewise.
* gnu/services/monitoring.scm (zabbix-server-configuration)
(zabbix-agent-configuration): Likewise.
* gnu/services/networking.scm (opendht-configuration): Likewise.
* gnu/services/pm.scm (tlp-configuration): Likewise.
* gnu/services/telephony.scm (jami-configuration): Likewise.
* gnu/services/virtualization.scm (libvirt-configuration)
(qemu-guest-agent-configuration): Likewise.
* gnu/services/vpn.scm (openvpn-client-configuration): Likewise.
2021-11-30 01:08:55 +01:00
Maxim Cournoyer 10f554700c
Reinstate "services: Add a service for Jami."
This reverts commit 4673f81793, which reverted
commit 69dcc24c9f with the fix detailed below.

Thanks to Christopher Baines for reporting the failure and proposing a fix.

* guix/self.scm (compiled-guix) [*system-test-modules*]: Add the test data
files via the 'extra-files' argument.
* gnu/local.mk (dist_patch_DATA): Move the tests/data/jami-dummy-account.dat
file to...
* gnu/local.mk (MODULES_NOT_COMPILED): ... here.
2021-08-02 17:23:30 -04:00
Maxim Cournoyer 4673f81793
Revert "services: Add a service for Jami."
This reverts commit 69dcc24c9f.  It broke 'guix
pull'.
2021-08-02 15:48:59 -04:00
Maxim Cournoyer 69dcc24c9f
services: Add a service for Jami.
* gnu/services/telephony.scm (string-or-computed-file?)
(string-list?, account-fingerprint-list?): New procedures.
(maybe-string-list, maybe-account-fingerprint-list)
(maybe-boolean, maybe-string, jami-account-list): New configuration field
types.
(serialize-string-list, serialize-boolean, serialize-string)
(jami-account, jami-account->alist, jami-configuration)
(jami-account-list?, jami-account-list-maybe): New procedures.
(%jami-accounts): New variable.
(jami-configuration->command-line-arguments): New procedure.
(jami-dbus-session-activation, jami-shepherd-services): New procedures.
(jami-service-type): New variable.
* gnu/build/jami-service.scm: New file.
* gnu/tests/data/jami-dummy-account.dat: Likewise.
* gnu/tests/telephony.scm: Likewise.
* gnu/local.mk (GNU_SYSTEM_MODULES): Register them.
* Makefile.am (SCM_TESTS): Register the test file.
(dist_patch_DATA): Register the new data file.
* doc/guix.texi (Telephony Services): Document it.
2021-08-02 15:15:02 -04:00
Simon Mages 83670e02bc
services: murmur: Add missing newline in murmur-configuration.
* gnu/services/telephony.scm (default-murmur-config): Add newline after
"max-user-bandwidth".

Signed-off-by: Marius Bakke <mbakke@fastmail.com>
2020-04-02 20:55:15 +02:00
nee b6d2930d1f
services: Add murmur.
* gnu/services/telephony.scm: New file.
* gnu/local.mk: Add it.
* doc/guix.texi (Telephony Services): New node.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2017-11-05 15:21:53 +01:00