services: Move 'device-mapping-service' to (gnu system mapped-devices).
* gnu/services/base.scm (device-mapping-service-type) (device-mapping-service): Move to... * gnu/system/mapped-devices.scm (device-mapping-service-type): (device-mapping-service): ... here. New variables.
This commit is contained in:
parent
374f14c265
commit
1ea507bce2
|
@ -48,7 +48,6 @@
|
||||||
root-file-system-service
|
root-file-system-service
|
||||||
file-system-service
|
file-system-service
|
||||||
user-unmount-service
|
user-unmount-service
|
||||||
device-mapping-service
|
|
||||||
swap-service
|
swap-service
|
||||||
user-processes-service
|
user-processes-service
|
||||||
session-environment-service
|
session-environment-service
|
||||||
|
@ -1175,26 +1174,6 @@ extra rules from the packages listed in @var{rules}."
|
||||||
(service udev-service-type
|
(service udev-service-type
|
||||||
(udev-configuration (udev udev) (rules rules))))
|
(udev-configuration (udev udev) (rules rules))))
|
||||||
|
|
||||||
(define device-mapping-service-type
|
|
||||||
(shepherd-service-type
|
|
||||||
'device-mapping
|
|
||||||
(match-lambda
|
|
||||||
((target open close)
|
|
||||||
(shepherd-service
|
|
||||||
(provision (list (symbol-append 'device-mapping- (string->symbol target))))
|
|
||||||
(requirement '(udev))
|
|
||||||
(documentation "Map a device node using Linux's device mapper.")
|
|
||||||
(start #~(lambda () #$open))
|
|
||||||
(stop #~(lambda _ (not #$close)))
|
|
||||||
(respawn? #f))))))
|
|
||||||
|
|
||||||
(define (device-mapping-service target open close)
|
|
||||||
"Return a service that maps device @var{target}, a string such as
|
|
||||||
@code{\"home\"} (meaning @code{/dev/mapper/home}). Evaluate @var{open}, a
|
|
||||||
gexp, to open it, and evaluate @var{close} to close it."
|
|
||||||
(service device-mapping-service-type
|
|
||||||
(list target open close)))
|
|
||||||
|
|
||||||
(define swap-service-type
|
(define swap-service-type
|
||||||
(shepherd-service-type
|
(shepherd-service-type
|
||||||
'swap
|
'swap
|
||||||
|
|
|
@ -19,7 +19,10 @@
|
||||||
(define-module (gnu system mapped-devices)
|
(define-module (gnu system mapped-devices)
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
#:use-module (guix records)
|
#:use-module (guix records)
|
||||||
|
#:use-module (gnu services)
|
||||||
|
#:use-module (gnu services shepherd)
|
||||||
#:autoload (gnu packages cryptsetup) (cryptsetup)
|
#:autoload (gnu packages cryptsetup) (cryptsetup)
|
||||||
|
#:use-module (ice-9 match)
|
||||||
#:export (mapped-device
|
#:export (mapped-device
|
||||||
mapped-device?
|
mapped-device?
|
||||||
mapped-device-source
|
mapped-device-source
|
||||||
|
@ -31,6 +34,9 @@
|
||||||
mapped-device-kind-open
|
mapped-device-kind-open
|
||||||
mapped-device-kind-close
|
mapped-device-kind-close
|
||||||
|
|
||||||
|
device-mapping-service-type
|
||||||
|
device-mapping-service
|
||||||
|
|
||||||
luks-device-mapping))
|
luks-device-mapping))
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
@ -54,6 +60,31 @@
|
||||||
(close mapped-device-kind-close ;source target -> gexp
|
(close mapped-device-kind-close ;source target -> gexp
|
||||||
(default (const #~(const #f)))))
|
(default (const #~(const #f)))))
|
||||||
|
|
||||||
|
|
||||||
|
;;;
|
||||||
|
;;; Device mapping as a Shepherd service.
|
||||||
|
;;;
|
||||||
|
|
||||||
|
(define device-mapping-service-type
|
||||||
|
(shepherd-service-type
|
||||||
|
'device-mapping
|
||||||
|
(match-lambda
|
||||||
|
((target open close)
|
||||||
|
(shepherd-service
|
||||||
|
(provision (list (symbol-append 'device-mapping- (string->symbol target))))
|
||||||
|
(requirement '(udev))
|
||||||
|
(documentation "Map a device node using Linux's device mapper.")
|
||||||
|
(start #~(lambda () #$open))
|
||||||
|
(stop #~(lambda _ (not #$close)))
|
||||||
|
(respawn? #f))))))
|
||||||
|
|
||||||
|
(define (device-mapping-service target open close)
|
||||||
|
"Return a service that maps device @var{target}, a string such as
|
||||||
|
@code{\"home\"} (meaning @code{/dev/mapper/home}). Evaluate @var{open}, a
|
||||||
|
gexp, to open it, and evaluate @var{close} to close it."
|
||||||
|
(service device-mapping-service-type
|
||||||
|
(list target open close)))
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; Common device mappings.
|
;;; Common device mappings.
|
||||||
|
|
Loading…
Reference in New Issue