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) | |
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 6865d03f25a..ebbe4e128dd 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | ;;; Copyright © 2021 Hui Lu <luhuins@163.com> | 17 | ;;; Copyright © 2021 Hui Lu <luhuins@163.com> |
| 18 | ;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com> | 18 | ;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com> |
| 19 | ;;; Copyright © 2022 Guillaume Le Vaillant <glv@posteo.net> | 19 | ;;; Copyright © 2022 Guillaume Le Vaillant <glv@posteo.net> |
| 20 | ;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li> | ||
| 20 | ;;; | 21 | ;;; |
| 21 | ;;; This file is part of GNU Guix. | 22 | ;;; This file is part of GNU Guix. |
| 22 | ;;; | 23 | ;;; |
| @@ -187,6 +188,12 @@ | |||
| 187 | guix-configuration-extra-options | 188 | guix-configuration-extra-options |
| 188 | guix-configuration-log-file | 189 | guix-configuration-log-file |
| 189 | 190 | ||
| 191 | guix-extension | ||
| 192 | guix-extension? | ||
| 193 | guix-extension-authorized-keys | ||
| 194 | guix-extension-substitute-urls | ||
| 195 | guix-extension-chroot-directories | ||
| 196 | |||
| 190 | guix-service-type | 197 | guix-service-type |
| 191 | guix-publish-configuration | 198 | guix-publish-configuration |
| 192 | guix-publish-configuration? | 199 | guix-publish-configuration? |
| @@ -1768,6 +1775,25 @@ proxy of 'guix-daemon'...~%") | |||
| 1768 | (substitute-key-authorization authorized-keys guix) | 1775 | (substitute-key-authorization authorized-keys guix) |
| 1769 | #~#f)))) | 1776 | #~#f)))) |
| 1770 | 1777 | ||
| 1778 | (define-record-type* <guix-extension> | ||
| 1779 | guix-extension make-guix-extension | ||
| 1780 | guix-extension? | ||
| 1781 | (authorized-keys guix-extension-authorized-keys ;list of file-like | ||
| 1782 | (default '())) | ||
| 1783 | (substitute-urls guix-extension-substitute-urls ;list of strings | ||
| 1784 | (default '())) | ||
| 1785 | (chroot-directories guix-extension-chroot-directories ;list of file-like/strings | ||
| 1786 | (default '()))) | ||
| 1787 | |||
| 1788 | (define (guix-extension-merge a b) | ||
| 1789 | (guix-extension | ||
| 1790 | (authorized-keys (append (guix-extension-authorized-keys a) | ||
| 1791 | (guix-extension-authorized-keys b))) | ||
| 1792 | (substitute-urls (append (guix-extension-substitute-urls a) | ||
| 1793 | (guix-extension-substitute-urls b))) | ||
| 1794 | (chroot-directories (append (guix-extension-chroot-directories a) | ||
| 1795 | (guix-extension-chroot-directories b))))) | ||
| 1796 | |||
| 1771 | (define guix-service-type | 1797 | (define guix-service-type |
| 1772 | (service-type | 1798 | (service-type |
| 1773 | (name 'guix) | 1799 | (name 'guix) |
| @@ -1778,14 +1804,19 @@ proxy of 'guix-daemon'...~%") | |||
| 1778 | (service-extension profile-service-type | 1804 | (service-extension profile-service-type |
| 1779 | (compose list guix-configuration-guix)))) | 1805 | (compose list guix-configuration-guix)))) |
| 1780 | 1806 | ||
| 1781 | ;; Extensions can specify extra directories to add to the build chroot. | 1807 | ;; Extensions can specify extra directories to add to the build chroot, |
| 1782 | (compose concatenate) | 1808 | ;; extra substitute urls and extra authorized keys |
| 1783 | (extend (lambda (config directories) | 1809 | (compose (lambda (args) (fold guix-extension-merge (guix-extension) args))) |
| 1810 | (extend (lambda (config extension) | ||
| 1784 | (guix-configuration | 1811 | (guix-configuration |
| 1785 | (inherit config) | 1812 | (inherit config) |
| 1813 | (authorized-keys (append (guix-extension-authorized-keys extension) | ||
| 1814 | (guix-configuration-authorized-keys config))) | ||
| 1815 | (substitute-urls (append (guix-extension-substitute-urls extension) | ||
| 1816 | (guix-configuration-substitute-urls config))) | ||
| 1786 | (chroot-directories | 1817 | (chroot-directories |
| 1787 | (append (guix-configuration-chroot-directories config) | 1818 | (append (guix-extension-chroot-directories extension) |
| 1788 | directories))))) | 1819 | (guix-configuration-chroot-directories config)))))) |
| 1789 | 1820 | ||
| 1790 | (default-value (guix-configuration)) | 1821 | (default-value (guix-configuration)) |
| 1791 | (description | 1822 | (description |
| @@ -1801,7 +1832,7 @@ proxy of 'guix-daemon'...~%") | |||
| 1801 | (default 80)) | 1832 | (default 80)) |
| 1802 | (host guix-publish-configuration-host ;string | 1833 | (host guix-publish-configuration-host ;string |
| 1803 | (default "localhost")) | 1834 | (default "localhost")) |
| 1804 | (advertise? guix-publish-advertise? ;boolean | 1835 | (advertise? guix-publish-advertise? ;boolean |
| 1805 | (default #f)) | 1836 | (default #f)) |
| 1806 | (compression guix-publish-configuration-compression | 1837 | (compression guix-publish-configuration-compression |
| 1807 | (thunked) | 1838 | (thunked) |
