summaryrefslogtreecommitdiff
path: root/gnu/system/linux-container.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-03-13 23:10:19 +0100
committerLudovic Courtès <ludo@gnu.org>2019-03-13 23:12:44 +0100
commitb94c80ff5d844f7763738ab5359fee72f11f9367 (patch)
tree9948fa92b84b443a9a41ff1e37a42181980c1884 /gnu/system/linux-container.scm
parente1c15e8b8e25e14c253ff1212e289565736f6ea7 (diff)
linux-container: 'containerized-operating-system' removes "useless" services.
Fixes <https://bugs.gnu.org/34211>. Reported by Efraim Flashner <efraim@flashner.co.il>. * gnu/system/linux-container.scm (containerized-operating-system) [useless-services]: New variable. Add 'services' field.
Diffstat (limited to 'gnu/system/linux-container.scm')
-rw-r--r--gnu/system/linux-container.scm14
1 files changed, 13 insertions, 1 deletions
diff --git a/gnu/system/linux-container.scm b/gnu/system/linux-container.scm
index bceea41332e..3fe3482d7fb 100644
--- a/gnu/system/linux-container.scm
+++ b/gnu/system/linux-container.scm
@@ -1,6 +1,6 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 David Thompson <davet@gnu.org> 2;;; Copyright © 2015 David Thompson <davet@gnu.org>
3;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org> 3;;; Copyright © 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
4;;; 4;;;
5;;; This file is part of GNU Guix. 5;;; This file is part of GNU Guix.
6;;; 6;;;
@@ -28,6 +28,7 @@
28 #:use-module (guix modules) 28 #:use-module (guix modules)
29 #:use-module (gnu build linux-container) 29 #:use-module (gnu build linux-container)
30 #:use-module (gnu services) 30 #:use-module (gnu services)
31 #:use-module (gnu services base)
31 #:use-module (gnu system) 32 #:use-module (gnu system)
32 #:use-module (gnu system file-systems) 33 #:use-module (gnu system file-systems)
33 #:export (system-container 34 #:export (system-container
@@ -54,8 +55,19 @@ containerized OS."
54 (file-system (inherit (file-system-mapping->bind-mount fs)) 55 (file-system (inherit (file-system-mapping->bind-mount fs))
55 (needed-for-boot? #t))) 56 (needed-for-boot? #t)))
56 57
58 (define useless-services
59 ;; Services that make no sense in a container. Those that attempt to
60 ;; access /dev/tty[0-9] in particular cannot work in a container.
61 (list console-font-service-type
62 mingetty-service-type
63 agetty-service-type))
64
57 (operating-system (inherit os) 65 (operating-system (inherit os)
58 (swap-devices '()) ; disable swap 66 (swap-devices '()) ; disable swap
67 (services (remove (lambda (service)
68 (memq (service-kind service)
69 useless-services))
70 (operating-system-user-services os)))
59 (file-systems (append (map mapping->fs (cons %store-mapping mappings)) 71 (file-systems (append (map mapping->fs (cons %store-mapping mappings))
60 %container-file-systems 72 %container-file-systems
61 user-file-systems)))) 73 user-file-systems))))