guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#54674] [PATCH v4 1/2] services: configuration: Support (field1 mayb


From: Maxime Devos
Subject: [bug#54674] [PATCH v4 1/2] services: configuration: Support (field1 maybe-number "") format.
Date: Sat, 23 Apr 2022 16:55:31 +0200
User-agent: Evolution 3.38.3-1

I didn't look into the code in detail, but for this kind of thing,
if it compiles, it probably works.  For completeness, you might want to
run a few system tests (‘make check-system’ IIRC).

However, ...

Attila Lendvai schreef op wo 20-04-2022 om 11:15 [+0200]:
> As opposed to explicitly using 'disabled as value, or using the
> (field1 (maybe-number) "") format.
> 
> It's mostly the work of Maxime Devos shared under #54674, with some
> modifications by Attila Lendvai.
> 
> * gnu/services/configuration.scm (normalize-field-type+def): New function.
> (define-configuration-helper) (define-configuration): Support new field
> format.
> * tests/services/configuration.scm (config-with-maybe-number->string): New
> function.
> ("maybe value serialization of the instance"): New test.
> ("maybe value serialization of the instance, unspecified"): New test.

... 'define-configuration' and 'disabled' is documented in the manual
(guix)Complex Configurations:

     When defining a “maybe type”, the corresponding serializer for the
     regular type will be used by default.  For example, a field of
     type ‘maybe-string’ will be serialized using the
     ‘serialize-string’ procedure by default, you can of course change
     this by specifying a custom serializer procedure.  Likewise, the
     type of the value would have to be a string, unless it is set to
     the ‘disabled’ symbol.

It also appears in other locations in the documentation:

     ‘daytime-brightness’ (default: ‘disabled’) (type: maybe-inexact-number)
          Daytime screen brightness, between 0.1 and 1.0.

   The available configuration parameters follow.  Each parameter
definition is preceded by its type; for example, ‘string-list foo’
indicates that the ‘foo’ parameter should be specified as a list of
strings.  Types starting with ‘maybe-’ denote parameters that won’t show
up in ‘prosody.cfg.lua’ when their value is ‘'disabled’.

     [...]

So the documentation appears to be needed to be changed as well.

Greetings,
Maxime.

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]