diff options
| author | Ian Eure <ian@retrospec.tv> | 2025-12-28 09:17:14 -0800 |
|---|---|---|
| committer | Ian Eure <ian@retrospec.tv> | 2025-12-28 09:57:09 -0800 |
| commit | 3dec0dbf14bb5224d12dbd3ecebf50dcc504f5c9 (patch) | |
| tree | 54decc53aa7bbc0f66abf5a252cfd8531252636f | |
| parent | 93e4c03938ae2c161885b615d66c613a544fc8ac (diff) | |
gnu: services: Support channels when extending guix-service-type.guix-extension-channels
Most of the configuration for guix-service-type can be extended (build
machines, substitutes, etc), but channels currently cannot. This commit adds
support for that.
* gnu/services/base.scm (guix-extension): Add `channels'.
(guix-extension-merge): Merge channels.
(guix-service-type): Add extension channels.
* doc/guix.texi (Getting Substitutes from Other Servers): Use a service
extension instead of modify-services.
(Base Services, guix-extension): Document channel field.
Change-Id: I26cd0556a536f49ecc61662fc10af080d6c6dc9f
| -rw-r--r-- | doc/guix.texi | 31 | ||||
| -rw-r--r-- | gnu/services/base.scm | 7 |
2 files changed, 20 insertions, 18 deletions
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 | |||
| 4018 | public keys of substitute servers to instruct Guix to accept the | 4018 | public keys of substitute servers to instruct Guix to accept the |
| 4019 | substitutes they sign. | 4019 | substitutes they sign. |
| 4020 | 4020 | ||
| 4021 | On Guix System, this is achieved by modifying the configuration of the | 4021 | On Guix System, this is achieved by extending the configuration of the |
| 4022 | @code{guix} service. Since the @code{guix} service is part of the | 4022 | @code{guix} service. @pxref{Service Composition, Service extensions} |
| 4023 | default lists of services, @code{%base-services} and | 4023 | allow users to easily add new configuration information. |
| 4024 | @code{%desktop-services}, you can use @code{modify-services} to change | ||
| 4025 | its configuration and add the URLs and substitute keys that you want | ||
| 4026 | (@pxref{Service Reference, @code{modify-services}}). | ||
| 4027 | 4024 | ||
| 4028 | As an example, suppose you want to fetch substitutes from | 4025 | As an example, suppose you want to fetch substitutes from |
| 4029 | @code{guix.example.org} and to authorize the signing key of that server, | 4026 | @code{guix.example.org} and to authorize the signing key of that server, |
| @@ -4035,18 +4032,13 @@ configuration will look something like: | |||
| 4035 | (operating-system | 4032 | (operating-system |
| 4036 | ;; @dots{} | 4033 | ;; @dots{} |
| 4037 | (services | 4034 | (services |
| 4038 | ;; Assume we're starting from '%desktop-services'. Replace it | 4035 | (cons |
| 4039 | ;; with the list of services you're actually using. | 4036 | (simple-service |
| 4040 | (modify-services %desktop-services | 4037 | 'my-guix-configuration guix-service-type |
| 4041 | (guix-service-type config => | 4038 | (guix-extension |
| 4042 | (guix-configuration | 4039 | (substitute-urls (list "https://guix.example.org")) |
| 4043 | (inherit config) | 4040 | (authorized-keys (list (local-file "./key.pub"))))) |
| 4044 | (substitute-urls | 4041 | %desktop-services))) |
| 4045 | (append (list "https://guix.example.org") | ||
| 4046 | %default-substitute-urls)) | ||
| 4047 | (authorized-keys | ||
| 4048 | (append (list (local-file "./key.pub")) | ||
| 4049 | %default-authorized-guix-keys))))))) | ||
| 4050 | @end lisp | 4042 | @end lisp |
| 4051 | 4043 | ||
| 4052 | This assumes that the file @file{key.pub} contains the signing key of | 4044 | This assumes that the file @file{key.pub} contains the signing key of |
| @@ -20702,6 +20694,9 @@ a guix service extension. | |||
| 20702 | @xref{Service Composition}, for more information. | 20694 | @xref{Service Composition}, for more information. |
| 20703 | 20695 | ||
| 20704 | @table @asis | 20696 | @table @asis |
| 20697 | @item @code{channels} (default: @code{'()}) | ||
| 20698 | A list of objects where each element is a channel record. | ||
| 20699 | |||
| 20705 | @item @code{authorized-keys} (default: @code{'()}) | 20700 | @item @code{authorized-keys} (default: @code{'()}) |
| 20706 | A list of file-like objects where each element contains a public key. | 20701 | A list of file-like objects where each element contains a public key. |
| 20707 | 20702 | ||
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 @@ | |||
| 241 | guix-extension | 241 | guix-extension |
| 242 | guix-extension? | 242 | guix-extension? |
| 243 | guix-extension-authorized-keys | 243 | guix-extension-authorized-keys |
| 244 | guix-extension-channels | ||
| 244 | guix-extension-substitute-urls | 245 | guix-extension-substitute-urls |
| 245 | guix-extension-chroot-directories | 246 | guix-extension-chroot-directories |
| 246 | 247 | ||
| @@ -2428,6 +2429,8 @@ guix-daemon have the right ownership.")) | |||
| 2428 | (define-record-type* <guix-extension> | 2429 | (define-record-type* <guix-extension> |
| 2429 | guix-extension make-guix-extension | 2430 | guix-extension make-guix-extension |
| 2430 | guix-extension? | 2431 | guix-extension? |
| 2432 | (channels guix-extension-channels ;list of channel | ||
| 2433 | (default '())) | ||
| 2431 | (authorized-keys guix-extension-authorized-keys ;list of file-like | 2434 | (authorized-keys guix-extension-authorized-keys ;list of file-like |
| 2432 | (default '())) | 2435 | (default '())) |
| 2433 | (substitute-urls guix-extension-substitute-urls ;list of strings | 2436 | (substitute-urls guix-extension-substitute-urls ;list of strings |
| @@ -2439,6 +2442,8 @@ guix-daemon have the right ownership.")) | |||
| 2439 | 2442 | ||
| 2440 | (define (guix-extension-merge a b) | 2443 | (define (guix-extension-merge a b) |
| 2441 | (guix-extension | 2444 | (guix-extension |
| 2445 | (channels (append (guix-extension-channels a) | ||
| 2446 | (guix-extension-channels b))) | ||
| 2442 | (authorized-keys (append (guix-extension-authorized-keys a) | 2447 | (authorized-keys (append (guix-extension-authorized-keys a) |
| 2443 | (guix-extension-authorized-keys b))) | 2448 | (guix-extension-authorized-keys b))) |
| 2444 | (substitute-urls (append (guix-extension-substitute-urls a) | 2449 | (substitute-urls (append (guix-extension-substitute-urls a) |
| @@ -2464,6 +2469,8 @@ guix-daemon have the right ownership.")) | |||
| 2464 | (extend (lambda (config extension) | 2469 | (extend (lambda (config extension) |
| 2465 | (guix-configuration | 2470 | (guix-configuration |
| 2466 | (inherit config) | 2471 | (inherit config) |
| 2472 | (channels (append (guix-extension-channels extension) | ||
| 2473 | (guix-configuration-channels config))) | ||
| 2467 | (authorized-keys (append (guix-extension-authorized-keys extension) | 2474 | (authorized-keys (append (guix-extension-authorized-keys extension) |
| 2468 | (guix-configuration-authorized-keys config))) | 2475 | (guix-configuration-authorized-keys config))) |
| 2469 | (substitute-urls (append (guix-extension-substitute-urls extension) | 2476 | (substitute-urls (append (guix-extension-substitute-urls extension) |
