diff --git a/doc/guix.texi b/doc/guix.texi index c504ec06cd7..a1f7ee5e862 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4018,12 +4018,9 @@ them in the specified order. You also need to explicitly authorize the public keys of substitute servers to instruct Guix to accept the substitutes they sign. -On Guix System, this is achieved by modifying the configuration of the -@code{guix} service. Since the @code{guix} service is part of the -default lists of services, @code{%base-services} and -@code{%desktop-services}, you can use @code{modify-services} to change -its configuration and add the URLs and substitute keys that you want -(@pxref{Service Reference, @code{modify-services}}). +On Guix System, this is achieved by extending the configuration of the +@code{guix} service. @pxref{Service Composition, Service extensions} +allow users to easily add new configuration information. As an example, suppose you want to fetch substitutes from @code{guix.example.org} and to authorize the signing key of that server, @@ -4035,18 +4032,13 @@ configuration will look something like: (operating-system ;; @dots{} (services - ;; Assume we're starting from '%desktop-services'. Replace it - ;; with the list of services you're actually using. - (modify-services %desktop-services - (guix-service-type config => - (guix-configuration - (inherit config) - (substitute-urls - (append (list "https://guix.example.org") - %default-substitute-urls)) - (authorized-keys - (append (list (local-file "./key.pub")) - %default-authorized-guix-keys))))))) + (cons + (simple-service + 'my-guix-configuration guix-service-type + (guix-extension + (substitute-urls (list "https://guix.example.org")) + (authorized-keys (list (local-file "./key.pub"))))) + %desktop-services))) @end lisp This assumes that the file @file{key.pub} contains the signing key of @@ -20702,6 +20694,9 @@ a guix service extension. @xref{Service Composition}, for more information. @table @asis +@item @code{channels} (default: @code{'()}) +A list of objects where each element is a channel record. + @item @code{authorized-keys} (default: @code{'()}) A list of file-like objects where each element contains a public key. diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 6a5ed3aa578..42d86ac3d32 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -241,6 +241,7 @@ guix-extension guix-extension? guix-extension-authorized-keys + guix-extension-channels guix-extension-substitute-urls guix-extension-chroot-directories @@ -2428,6 +2429,8 @@ guix-daemon have the right ownership.")) (define-record-type* guix-extension make-guix-extension guix-extension? + (channels guix-extension-channels ;list of channel + (default '())) (authorized-keys guix-extension-authorized-keys ;list of file-like (default '())) (substitute-urls guix-extension-substitute-urls ;list of strings @@ -2439,6 +2442,8 @@ guix-daemon have the right ownership.")) (define (guix-extension-merge a b) (guix-extension + (channels (append (guix-extension-channels a) + (guix-extension-channels b))) (authorized-keys (append (guix-extension-authorized-keys a) (guix-extension-authorized-keys b))) (substitute-urls (append (guix-extension-substitute-urls a) @@ -2464,6 +2469,8 @@ guix-daemon have the right ownership.")) (extend (lambda (config extension) (guix-configuration (inherit config) + (channels (append (guix-extension-channels extension) + (guix-configuration-channels config))) (authorized-keys (append (guix-extension-authorized-keys extension) (guix-configuration-authorized-keys config))) (substitute-urls (append (guix-extension-substitute-urls extension)