diff options
author | terramorpha <terramorpha@cock.li> | 2022-04-11 00:30:07 -0400 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2022-06-13 12:27:35 +0200 |
commit | fcad6226486b52e5d45531f60811d35eac34fa67 (patch) | |
tree | 043620f1a05a23cf5f832b15cbb1cc3f03b6d9e8 /gnu/services | |
parent | 8918ce6d1622303465e716ae491b8e5124c7aece (diff) | |
download | guix-fcad6226486b52e5d45531f60811d35eac34fa67.tar guix-fcad6226486b52e5d45531f60811d35eac34fa67.tar.gz |
services: guix: Generalize extensions.
* gnu/services/base.scm (<guix-extension>): New record type.
(guix-extension-merge): New procedure.
(guix-service-type): Honor extensions.
* doc/guix.texi (Base Services): Document it.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/services')
-rw-r--r-- | gnu/services/base.scm | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 6865d03f25..ebbe4e128d 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -17,6 +17,7 @@ ;;; Copyright © 2021 Hui Lu <luhuins@163.com> ;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; Copyright © 2022 Guillaume Le Vaillant <glv@posteo.net> +;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li> ;;; ;;; This file is part of GNU Guix. ;;; @@ -187,6 +188,12 @@ guix-configuration-extra-options guix-configuration-log-file + guix-extension + guix-extension? + guix-extension-authorized-keys + guix-extension-substitute-urls + guix-extension-chroot-directories + guix-service-type guix-publish-configuration guix-publish-configuration? @@ -1768,6 +1775,25 @@ proxy of 'guix-daemon'...~%") (substitute-key-authorization authorized-keys guix) #~#f)))) +(define-record-type* <guix-extension> + guix-extension make-guix-extension + guix-extension? + (authorized-keys guix-extension-authorized-keys ;list of file-like + (default '())) + (substitute-urls guix-extension-substitute-urls ;list of strings + (default '())) + (chroot-directories guix-extension-chroot-directories ;list of file-like/strings + (default '()))) + +(define (guix-extension-merge a b) + (guix-extension + (authorized-keys (append (guix-extension-authorized-keys a) + (guix-extension-authorized-keys b))) + (substitute-urls (append (guix-extension-substitute-urls a) + (guix-extension-substitute-urls b))) + (chroot-directories (append (guix-extension-chroot-directories a) + (guix-extension-chroot-directories b))))) + (define guix-service-type (service-type (name 'guix) @@ -1778,14 +1804,19 @@ proxy of 'guix-daemon'...~%") (service-extension profile-service-type (compose list guix-configuration-guix)))) - ;; Extensions can specify extra directories to add to the build chroot. - (compose concatenate) - (extend (lambda (config directories) + ;; Extensions can specify extra directories to add to the build chroot, + ;; extra substitute urls and extra authorized keys + (compose (lambda (args) (fold guix-extension-merge (guix-extension) args))) + (extend (lambda (config extension) (guix-configuration (inherit config) + (authorized-keys (append (guix-extension-authorized-keys extension) + (guix-configuration-authorized-keys config))) + (substitute-urls (append (guix-extension-substitute-urls extension) + (guix-configuration-substitute-urls config))) (chroot-directories - (append (guix-configuration-chroot-directories config) - directories))))) + (append (guix-extension-chroot-directories extension) + (guix-configuration-chroot-directories config)))))) (default-value (guix-configuration)) (description @@ -1801,7 +1832,7 @@ proxy of 'guix-daemon'...~%") (default 80)) (host guix-publish-configuration-host ;string (default "localhost")) - (advertise? guix-publish-advertise? ;boolean + (advertise? guix-publish-advertise? ;boolean (default #f)) (compression guix-publish-configuration-compression (thunked) |