diff options
| -rw-r--r-- | doc/guix.texi | 7 | ||||
| -rw-r--r-- | gnu/services/base.scm | 9 | ||||
| -rw-r--r-- | gnu/system/linux-container.scm | 43 |
3 files changed, 38 insertions, 21 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 52e36e4354b..1cee7db99c5 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
| @@ -19661,6 +19661,13 @@ Name of the group for build user accounts. | |||
| 19661 | @item @code{build-accounts} (default: @code{10}) | 19661 | @item @code{build-accounts} (default: @code{10}) |
| 19662 | Number of build user accounts to create. | 19662 | Number of build user accounts to create. |
| 19663 | 19663 | ||
| 19664 | @item @code{chroot?} (default: @code{'default}) | ||
| 19665 | The value should be one of @code{#t} or @code{#f}, in which | ||
| 19666 | case chroot is enabled or disabled, respectively; | ||
| 19667 | or it should be @code{'default}, which amounts to @code{#f} in | ||
| 19668 | Docker containers (so that they can be run in non-privileged mode) | ||
| 19669 | or @code{#t} otherwise. | ||
| 19670 | |||
| 19664 | @item @code{authorize-key?} (default: @code{#t}) | 19671 | @item @code{authorize-key?} (default: @code{#t}) |
| 19665 | @cindex substitutes, authorization thereof | 19672 | @cindex substitutes, authorization thereof |
| 19666 | Whether to authorize the substitute keys listed in | 19673 | Whether to authorize the substitute keys listed in |
diff --git a/gnu/services/base.scm b/gnu/services/base.scm index feca7ecce91..4bc47f2f5d9 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | ;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li> | 21 | ;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li> |
| 22 | ;;; Copyright © 2022 ( <paren@disroot.org> | 22 | ;;; Copyright © 2022 ( <paren@disroot.org> |
| 23 | ;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu> | 23 | ;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu> |
| 24 | ;;; Copyright © 2024 Andreas Enge <andreas@enge.fr> | ||
| 24 | ;;; | 25 | ;;; |
| 25 | ;;; This file is part of GNU Guix. | 26 | ;;; This file is part of GNU Guix. |
| 26 | ;;; | 27 | ;;; |
| @@ -213,6 +214,7 @@ | |||
| 213 | guix-configuration-build-group | 214 | guix-configuration-build-group |
| 214 | guix-configuration-build-accounts | 215 | guix-configuration-build-accounts |
| 215 | guix-configuration-build-machines | 216 | guix-configuration-build-machines |
| 217 | guix-configuration-chroot? | ||
| 216 | guix-configuration-authorize-key? | 218 | guix-configuration-authorize-key? |
| 217 | guix-configuration-authorized-keys | 219 | guix-configuration-authorized-keys |
| 218 | guix-configuration-use-substitutes? | 220 | guix-configuration-use-substitutes? |
| @@ -1849,6 +1851,8 @@ archive' public keys, with GUIX." | |||
| 1849 | (default "guixbuild")) | 1851 | (default "guixbuild")) |
| 1850 | (build-accounts guix-configuration-build-accounts ;integer | 1852 | (build-accounts guix-configuration-build-accounts ;integer |
| 1851 | (default 10)) | 1853 | (default 10)) |
| 1854 | (chroot? guix-configuration-chroot? ;Boolean | 'default | ||
| 1855 | (default 'default)) | ||
| 1852 | (authorize-key? guix-configuration-authorize-key? ;Boolean | 1856 | (authorize-key? guix-configuration-authorize-key? ;Boolean |
| 1853 | (default #t)) | 1857 | (default #t)) |
| 1854 | (authorized-keys guix-configuration-authorized-keys ;list of gexps | 1858 | (authorized-keys guix-configuration-authorized-keys ;list of gexps |
| @@ -1943,7 +1947,7 @@ proxy of 'guix-daemon'...~%") | |||
| 1943 | glibc-utf8-locales))) | 1947 | glibc-utf8-locales))) |
| 1944 | 1948 | ||
| 1945 | (match-record config <guix-configuration> | 1949 | (match-record config <guix-configuration> |
| 1946 | (guix build-group build-accounts authorize-key? authorized-keys | 1950 | (guix build-group build-accounts chroot? authorize-key? authorized-keys |
| 1947 | use-substitutes? substitute-urls max-silent-time timeout | 1951 | use-substitutes? substitute-urls max-silent-time timeout |
| 1948 | log-compression discover? extra-options log-file | 1952 | log-compression discover? extra-options log-file |
| 1949 | http-proxy tmpdir chroot-directories environment) | 1953 | http-proxy tmpdir chroot-directories environment) |
| @@ -1990,6 +1994,9 @@ proxy of 'guix-daemon'...~%") | |||
| 1990 | "--substitute-urls" #$(string-join substitute-urls) | 1994 | "--substitute-urls" #$(string-join substitute-urls) |
| 1991 | #$@extra-options | 1995 | #$@extra-options |
| 1992 | 1996 | ||
| 1997 | #$@(if chroot? | ||
| 1998 | '() | ||
| 1999 | '("--disable-chroot")) | ||
| 1993 | ;; Add CHROOT-DIRECTORIES and all their dependencies | 2000 | ;; Add CHROOT-DIRECTORIES and all their dependencies |
| 1994 | ;; (if these are store items) to the chroot. | 2001 | ;; (if these are store items) to the chroot. |
| 1995 | (append-map | 2002 | (append-map |
diff --git a/gnu/system/linux-container.scm b/gnu/system/linux-container.scm index c780b68fba4..c1705f491cc 100644 --- a/gnu/system/linux-container.scm +++ b/gnu/system/linux-container.scm | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | ;;; Copyright © 2022 Ricardo Wurmus <rekado@elephly.net> | 7 | ;;; Copyright © 2022 Ricardo Wurmus <rekado@elephly.net> |
| 8 | ;;; Copyright © 2023 Pierre Langlois <pierre.langlois@gmx.com> | 8 | ;;; Copyright © 2023 Pierre Langlois <pierre.langlois@gmx.com> |
| 9 | ;;; Copyright © 2024 Leo Nikkilä <hello@lnikki.la> | 9 | ;;; Copyright © 2024 Leo Nikkilä <hello@lnikki.la> |
| 10 | ;;; Copyright © 2024 Andreas Enge <andreas@enge.fr> | ||
| 10 | ;;; | 11 | ;;; |
| 11 | ;;; This file is part of GNU Guix. | 12 | ;;; This file is part of GNU Guix. |
| 12 | ;;; | 13 | ;;; |
| @@ -151,26 +152,28 @@ containerized OS. EXTRA-FILE-SYSTEMS is a list of file systems to add to OS." | |||
| 151 | (swap-devices '()) ; disable swap | 152 | (swap-devices '()) ; disable swap |
| 152 | (services | 153 | (services |
| 153 | (append services-to-add | 154 | (append services-to-add |
| 154 | (filter-map (lambda (s) | 155 | (filter-map |
| 155 | (cond ((memq (service-kind s) services-to-drop) | 156 | (lambda (s) |
| 156 | #f) | 157 | (let ((kind (service-kind s)) |
| 157 | ((eq? nscd-service-type (service-kind s)) | 158 | (value (service-value s))) |
| 158 | (service nscd-service-type | 159 | (cond ((memq kind services-to-drop) |
| 159 | (nscd-configuration | 160 | #f) |
| 160 | (inherit (service-value s)) | 161 | ((eq? nscd-service-type kind) |
| 161 | (caches %nscd-container-caches)))) | 162 | (service nscd-service-type |
| 162 | ((eq? guix-service-type (service-kind s)) | 163 | (nscd-configuration |
| 163 | ;; Pass '--disable-chroot' so that | 164 | (inherit value) |
| 164 | ;; guix-daemon can build thing even in | 165 | (caches %nscd-container-caches)))) |
| 165 | ;; Docker without '--privileged'. | 166 | ((and (eq? guix-service-type kind) |
| 166 | (service guix-service-type | 167 | (eq? (guix-configuration-chroot? value) |
| 167 | (guix-configuration | 168 | 'default)) |
| 168 | (inherit (service-value s)) | 169 | ;; If chroot? is 'default, it should become #f |
| 169 | (extra-options | 170 | ;; so that guix-daemon can build things even in |
| 170 | (cons "--disable-chroot" | 171 | ;; Docker without '--privileged'. |
| 171 | (guix-configuration-extra-options | 172 | (service guix-service-type |
| 172 | (service-value s))))))) | 173 | (guix-configuration |
| 173 | (else s))) | 174 | (inherit value) |
| 175 | (chroot? #f)))) | ||
| 176 | (else s)))) | ||
| 174 | (operating-system-user-services os)))) | 177 | (operating-system-user-services os)))) |
| 175 | (file-systems (append (map mapping->fs | 178 | (file-systems (append (map mapping->fs |
| 176 | (if shared-network? | 179 | (if shared-network? |
