diff options
| author | Andreas Enge <andreas@enge.fr> | 2024-07-05 15:47:13 +0200 |
|---|---|---|
| committer | Andreas Enge <andreas@enge.fr> | 2025-02-17 14:57:55 +0100 |
| commit | 9a41ec57626b63fa0efbd81483e20d541d4b068c (patch) | |
| tree | e2bd92c6064ac6fee3dbce15942079ddae25d074 /gnu/system | |
| parent | f0d4daa13f0b57f5c03af73d449b2c6dd3160d08 (diff) | |
gnu: guix-configuration: Add a chroot? parameter.
The parameter should take the values #t, #f or 'default.
In a container environment, 'default amounts to #f, otherwise it
amounts to #t.
* gnu/services/base.scm (guix-configuration)<chroot?>: New field.
(guix-shepherd-service): If chroot? is #f, add "--disable-chroot".
If it is #t or 'default, do nothing.
* gnu/system/linux-container.scm (containerized-operating-system):
If chroot? is 'default, replace it by #f.
* doc/guix.texi: Document the parameter.
Change-Id: I8b9c3f46ad8650fa6ed4acee947b4ae5d002d03d
Diffstat (limited to 'gnu/system')
| -rw-r--r-- | gnu/system/linux-container.scm | 43 |
1 files changed, 23 insertions, 20 deletions
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? |
