Subject: Re: [bug#33836] [PATCH 1/2] services: configuration: Add location.

From: Ludovic Courtès <[email-masked]>
Date: Wed, 26 Dec 2018 18:30:09 +0100

Hello,

Oleg Pykhalov <[email-masked]> skribis:

> * gnu/services/configuration.scm (define-configuration): Add location.
> * gnu/services/mail.scm (namespace-configuration)[location]: Rename to
> 'mailbox-location'.
> (uglify-field-name): Handle this.
> * doc/guix.texi (Mail Services): Document this.

Nice!

> --- a/gnu/services/configuration.scm
> +++ b/gnu/services/configuration.scm
> @@ -22,6 +22,7 @@
>    #:use-module (guix packages)
>    #:use-module (guix records)
>    #:use-module (guix gexp)
> +  #:use-module ((guix utils) #:select (source-properties->location))
>    #:autoload   (texinfo) (texi-fragment->stexi)
>    #:autoload   (texinfo serialize) (stexi->texi)
>    #:use-module (ice-9 match)
> @@ -129,6 +130,10 @@
>                   #,(id #'stem #'% #'stem)
>                   #,(id #'stem #'make- #'stem)
>                   #,(id #'stem #'stem #'?)
> +                 (location configuration-location
> +                           (default (and=> (current-source-location)
> +                                           source-properties->location))
> +                           (innate))

What about calling the field ‘%location’ instead?  That would avoid the
collision with the other ‘location’ field and it should be fine because
it’s not a field we manually set anyway.

Also, instead of ‘configuration-location’, shouldn’t it be

  (id #'stem #'-location)

?  That will avoid ending up with one ‘configuration-location’ binding
for each record type.

Thanks,
Ludo’.