summaryrefslogtreecommitdiff
path: root/gnu/system.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-09-18 22:51:48 +0200
committerLudovic Courtès <ludo@gnu.org>2014-09-18 22:52:01 +0200
commit2a13d05e459946d4989e08461233d7f147f029f5 (patch)
tree648676170ffd849fca28d245093b30206035a715 /gnu/system.scm
parent715fc9d44d284a0c5e1ded45091eaf979aa5ecd4 (diff)
system: Add support for swap devices.
* gnu/services/base.scm (swap-service): New procedure. * gnu/system.scm (<operating-system>)[swap-devices]: New field. (swap-services): New procedure. (essential-services): Use it.
Diffstat (limited to 'gnu/system.scm')
-rw-r--r--gnu/system.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 6f0469a763..13b461c003 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -105,6 +105,8 @@
(mapped-devices operating-system-mapped-devices ; list of <mapped-device>
(default '()))
(file-systems operating-system-file-systems) ; list of fs
+ (swap-devices operating-system-swap-devices ; list of strings
+ (default '()))
(users operating-system-users ; list of user accounts
(default '()))
@@ -228,6 +230,11 @@ as 'needed-for-boot'."
(close source target))))
(operating-system-mapped-devices os))))
+(define (swap-services os)
+ "Return the list of swap services for OS as a monadic list."
+ (sequence %store-monad
+ (map swap-service (operating-system-swap-devices os))))
+
(define (essential-services os)
"Return the list of essential services for OS. These are special services
that implement part of what's declared in OS are responsible for low-level
@@ -235,13 +242,14 @@ bookkeeping."
(mlet* %store-monad ((mappings (device-mapping-services os))
(root-fs (root-file-system-service))
(other-fs (other-file-system-services os))
+ (swaps (swap-services os))
(procs (user-processes-service
(map (compose first service-provision)
other-fs)))
(host-name (host-name-service
(operating-system-host-name os))))
(return (cons* host-name procs root-fs
- (append other-fs mappings)))))
+ (append other-fs mappings swaps)))))
(define (operating-system-services os)
"Return all the services of OS, including \"internal\" services that do not