summaryrefslogtreecommitdiff
path: root/gnu/services/configuration.scm
Commit message (Collapse)AuthorAge
* services: configuration: Add a define-configuration/no-serialization syntax.Maxim Cournoyer2021-05-17
| | | | | | | | This is added for convenience and for uniformity with the define-maybe/no-serialization syntax introduced in the previous commit. * gnu/services/configuration.scm (define-configuration/no-serialization): New syntax.
* services: configuration: Add a define-maybe/no-serialization syntax.Maxim Cournoyer2021-05-17
| | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, using define-maybe along define-configuration with the no-serialization syntactic keyword would result in the following warning: warning: possibly unbound variable `VARIABLE-NAME' This change introduces the define-maybe/no-serialization variant that does away with defining a serialization helper procedure, which makes it possible to avoid the above warning. * gnu/services/configuration.scm (define-maybe/no-serialization): New syntax. (define-maybe-helper): New procedure. (define-maybe): Define syntax using the above procedure. * tests/services/configuration.scm (tests): Fix module name. (custom-number-serializer): Do not print to standard output. (maybe-number?, serialize-maybe-number): New procedures defined via the define-maybe macro. (config-with-maybe-number): New configuration. (serialize-number): New procedure. ("maybe value serialization"): New test. (maybe-string?): New procedure defined via the define-maybe/no-serialization macro. (config-with-maybe-string/no-serialization): New configuration. ("maybe value without serialization no procedure bound"): New test.
* services: configuration: Export 'no-serialization' syntactic keyword.Ludovic Courtès2021-05-08
| | | | | | This is a followup to 3f9a12dc082b20426fc740416601b69ea1897193. * gnu/services/configuration.scm (no-serialization): New variable.
* services: configuration: Fix %location accessor name.Maxim Cournoyer2021-05-08
| | | | | | | | | | | | | The non-hygienic binding of the source location accessor was set to '-location'; in modules where multiple configurations were defined, it would cause compilation warnings such as: gnu/services/mail.scm:175:0: warning: shadows previous definition of `%-location-procedure' at gnu/services/mail.scm:165:0 * gnu/services/configuration.scm (define-configuration-helper) <id>: Add a missing #'stem argument to use the configuration name as a prefix to the location accessor identifier.
* services: configuration: Allow specifying a custom serializer.Xinglu Chen2021-05-08
| | | | | | | | | | | | | | | | | | In some cases, rather than globally disabling serialization, it may be more appropriate to disable or otherwise alter the serialization procedure of a specific field. In large module, multiple configurations may also exist that would need to alter the default serialization procedure, which is named after the field type. Being able to specify a per-field serialization procedure provides more flexibility. * gnu/services/configuration.scm (define-configuration): Add an optional pattern variable to allow specifying a custom serialization procedure. (define-configuration-helper) <field-serializer>: Use it to transform the syntax. (empty-serializer): New procedure. (serialize-package): Alias to ‘empty-serializer’. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
* services: configuration: Allow disabling serialization.Maxim Cournoyer2021-05-08
| | | | | | | | | | | | | | Serialization is not always useful, for example when deriving command line arguments from a configuration. This change provides a way to turn it off, which removes the need to define a bunch of dummy serialization procedures. Credit goes to Andrew Gierth (RhodiumToad) from #guile for providing the solution. Thank you! * gnu/services/configuration.scm (define-configuration-helper): New procedure. (define-configuration) <no-serialization>: New syntactic keyword. Use it in a new pattern. Refactor the macro so that it makes use of the above helper procedure.
* services: configuration: Avoid a compilation warning.Maxim Cournoyer2021-05-08
| | | | | | | This resolves a compilation warning introduced with commit bb716e8d9d. * gnu/services/configuration.scm (configuration->documentation): Use display to print the string instead of format.
* services: configuration: Add a new helper to ease generating documentation.Maxim Cournoyer2021-05-07
| | | | | | | The original (undocumented) procedure to generate the doc has a difficult to grasp interface; add a simpler one on top of it. * gnu/services/configuration.scm (configuration->documentation): New procedure.
* services: configuration: Support fields without default values.Xinglu Chen2021-05-07
| | | | | | | | | | | Not all fields in a configuration have a sensible default value. This changes makes it possible to omit a default value for a configuration field, requiring the user to provide a value. * gnu/services/configuration.scm (configuration-missing-field): New procedure. (define-configuration): Make default value optional. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
* services: configuration: Add '%location'.Oleg Pykhalov2019-03-10
| | | | * gnu/services/configuration.scm (define-configuration): Add '%location'.
* services: messaging: Prosody config supports file-like objects.Clément Lassieur2018-03-03
| | | | | | | | | | | | | | | | | | | | | | | | * doc/guix.texi (Messaging Services): Update accordingly. * gnu/services/configuration.scm (serialize-configuration, serialize-maybe-stem, serialize-package): Return strings or string-valued gexps (these procedures were only used for their side-effects). * gnu/services/messaging.scm (serialize-field, serialize-field-list, enclose-quotes, serialize-raw-content, serialize-ssl-configuration, serialize-virtualhost-configuration-list, serialize-int-component-configuration-list, serialize-ext-component-configuration-list, serialize-virtualhost-configuration, serialize-int-component-configuration, serialize-ext-component-configuration, serialize-prosody-configuration): Return strings or string-valued gexps and stop printing. (prosody-activation): Use SERIALIZE-PROSODY-CONFIGURATION's return value with MIXED-TEXT-FILE instead of using its output with PLAIN-FILE. (serialize-non-negative-integer, serialize-non-negative-integer-list): Convert numbers to strings. (file-object?, serialize-file-object, file-object-list?, serialize-file-object-list): New procedures. (ssl-configuration)[capath, cafile], (prosody-configuration)[plugin-paths, groups-file]: Replace FILE-NAME with FILE-OBJECT. * guix/gexp.scm (file-like?): New exported procedure.
* services: configuration: Show default values of list types.Clément Lassieur2017-11-28
| | | | | | | * doc/guix.texi (Messaging Services): Regenerate it. * gnu/services/configuration.scm (show-default?): Check VAL rather than DEFAULT. * gnu/services/messaging.scm (show-default?): Check VAL rather than DEFAULT. (prosody-configuration)[modules-enabled]: Remove default value from docstring.
* services: configuration: Rewrite id procedure.Mathieu Othacehe2017-03-24
| | | | | | | * gnu/services/configuration.scm (id): Replace it using the more concise version found in messaging.scm. Signed-off-by: Clément Lassieur <clement@lassieur.org>
* services: Factorize define-maybe macro.Mathieu Othacehe2017-03-24
| | | | | | | | | | | * gnu/services/configuration.scm (id): New procedure extracted from define-configuration. (define-maybe): New exported procedure, moved from messaging.scm. * gnu/services/messaging.scm (define-maybe): Remove it. (id): Move declaration inside define-all-configurations which is now the only caller procedure. Signed-off-by: Clément Lassieur <clement@lassieur.org>
* services: Move configuration functions that shouldn't be factorized.Clément Lassieur2017-03-12
| | | | | | | | | | | | | | * gnu/services/configuration.scm (serialize-field, serialize-string) (serialize-space-separated-string-list, space-separated-string-list?) (serialize-file-name, file-name?, serialize-boolean): Move these functions... * gnu/services/cups.scm: ...to this file. * gnu/services/kerberos.scm: ...to this file. Configuration syntaxes are very specific to services. Some services may have the same configuration syntax, but none of them is common enough to be abstracted in configuration.scm. Signed-off-by: Clément Lassieur <clement@lassieur.org>
* gnu: Add Prosody service.Clément Lassieur2017-01-08
| | | | | | | | | * gnu/services/messaging.scm: New file. * gnu/services/configuration.scm: New exported procedures. * gnu/local.mk (GNU_SYSTEM_MODULES): Add gnu/services/messaging.scm. * doc/guix.texi (Messaging Services): New section. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* gnu: Add Kerberos client service.John Darrington2016-12-03
| | | | | | | * doc/guix.texi (Kerberos Services)[Krb5 Service]: New subsubheading. * gnu/services/kerberos.scm (krb5-service-type): New variable. * gnu/services/configuration.scm (configuration-field-serializer, configuration-field-getter): Export variables.
* services: Factorize configuration abstraction.Julien Lepiller2016-11-26
* gnu/services/mail.scm and gnu/services/cups.scm (&configuration-error) (configuration-error, configuration-field-error) (configuration-missing-field, configuration-field, serialize-configuration) (validate-configuration, define-configuration, uglify-field-name) (serialize-field, serialize-package, serialize-string) (serialize-space-separated-string-list, space-separated-string-list?) (serialize-file-name, file-name?, serialize-field-name) (generate-documentation): Move duplicate code... * gnu/services/configuration.scm: ...to this new file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add configuration.scm. Signed-off-by: Ludovic Courtès <ludo@gnu.org>