aboutsummaryrefslogtreecommitdiff
path: root/gnu/services/base.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-08-21 18:50:14 +0200
committerLudovic Courtès <ludo@gnu.org>2016-08-22 00:20:48 +0200
commitaa1145df8d43187f3e92aa505298cdeca4fb1191 (patch)
tree9f3db5b3bf8d8228232b59f99c7b0599f901e3f0 /gnu/services/base.scm
parent9af4983266ea1a1fedfe97bb122779322470275b (diff)
downloadguix-aa1145df8d43187f3e92aa505298cdeca4fb1191.tar
guix-aa1145df8d43187f3e92aa505298cdeca4fb1191.tar.gz
services: Make a single extensible 'file-systems' service.
Previously we would create one 'file-system-service-type' instead per file system. Now, we create only one instance for all the file systems. * gnu/services/base.scm (fstab-service-type)[compose]: Change to CONCATENATE. (file-system-shepherd-service): Change to return either one <shepherd-service> or #f. (file-system-service-type): Pluralize 'name'. Adjust SHEPHERD-ROOT-SERVICE-TYPE extension to above changes. Add 'compose' and 'extend'. (file-system-service): Remove. * gnu/system.scm (other-file-system-services): Rename to... (non-boot-file-system-service): ... this. Change to return a single FILE-SYSTEM-SERVICE-TYPE instance. (essential-services): Adjust accordingly.
Diffstat (limited to 'gnu/services/base.scm')
-rw-r--r--gnu/services/base.scm34
1 files changed, 15 insertions, 19 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 3b4c22f8a2..f3f6408687 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -49,7 +49,7 @@
#:use-module (ice-9 format)
#:export (fstab-service-type
root-file-system-service
- file-system-service
+ file-system-service-type
user-unmount-service
swap-service
user-processes-service
@@ -164,7 +164,7 @@
(extensions
(list (service-extension etc-service-type
file-systems->fstab)))
- (compose identity)
+ (compose concatenate)
(extend append)))
(define %root-file-system-shepherd-service
@@ -230,7 +230,8 @@ FILE-SYSTEM."
(file-system->shepherd-service-name fs))))
(define (file-system-shepherd-service file-system)
- "Return a list containing the shepherd service for @var{file-system}."
+ "Return the shepherd service for @var{file-system}, or @code{#f} if
+@var{file-system} is not auto-mounted upon boot."
(let ((target (file-system-mount-point file-system))
(device (file-system-device file-system))
(type (file-system-type file-system))
@@ -238,10 +239,9 @@ FILE-SYSTEM."
(check? (file-system-check? file-system))
(create? (file-system-create-mount-point? file-system))
(dependencies (file-system-dependencies file-system)))
- (if (file-system-mount? file-system)
- (with-imported-modules '((gnu build file-systems)
- (guix build bournish))
- (list
+ (and (file-system-mount? file-system)
+ (with-imported-modules '((gnu build file-systems)
+ (guix build bournish))
(shepherd-service
(provision (list (file-system->shepherd-service-name file-system)))
(requirement `(root-file-system
@@ -290,23 +290,19 @@ FILE-SYSTEM."
;; We need an additional module.
(modules `(((gnu build file-systems)
#:select (check-file-system canonicalize-device-spec))
- ,@%default-modules)))))
- '())))
+ ,@%default-modules)))))))
(define file-system-service-type
- ;; TODO(?): Make this an extensible service that takes <file-system> objects
- ;; and returns a list of <shepherd-service>.
- (service-type (name 'file-system)
+ (service-type (name 'file-systems)
(extensions
(list (service-extension shepherd-root-service-type
- file-system-shepherd-service)
+ (lambda (file-systems)
+ (filter-map file-system-shepherd-service
+ file-systems)))
(service-extension fstab-service-type
- identity)))))
-
-(define* (file-system-service file-system)
- "Return a service that mounts @var{file-system}, a @code{<file-system>}
-object."
- (service file-system-service-type file-system))
+ identity)))
+ (compose concatenate)
+ (extend append)))
(define user-unmount-service-type
(shepherd-service-type