summary refs log tree commit diff
path: root/gnu/system.scm
diff options
context:
space:
mode:
authorJosselin Poiret <dev@jpoiret.xyz>2021-11-15 20:26:30 +0000
committerLudovic Courtès <ludo@gnu.org>2021-11-23 10:24:27 +0100
commit4af3262d9857405aff0a4a855403247f0f485e15 (patch)
tree58ef14230a9a8f52e408b9488059779d78a6ab70 /gnu/system.scm
parent0831dfab75b4db9c8bcbc9b2d1e52d8db54d0ad9 (diff)
downloadguix-4af3262d9857405aff0a4a855403247f0f485e15.tar.gz
system: Filter out boot dependencies from swap-space.
* gnu/systems.scm (swap-services): Filter them.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/system.scm')
-rw-r--r--gnu/system.scm20
1 files changed, 19 insertions, 1 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 2e5a5ff7c8..9de0f79b44 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -601,7 +601,25 @@ See \"(guix) operating-system Reference\" for more details.~%")))
 
 (define (swap-services os)
   "Return the list of swap services for OS."
-  (map swap-service (operating-system-swap-devices os)))
+  (define early-userspace-file-systems
+    (filter file-system-needed-for-boot?
+            (operating-system-file-systems os)))
+
+  (define early-userspace-mapped-devices
+    (operating-system-boot-mapped-devices os))
+
+  (define (filter-deps swap)
+    (if (swap-space? swap)
+        (swap-space
+         (inherit swap)
+         (dependencies (remove (lambda (dep)
+                                 (or (member dep early-userspace-mapped-devices)
+                                     (member dep early-userspace-file-systems)))
+                               (swap-space-dependencies swap))))
+        swap))
+
+  (map (compose swap-service filter-deps)
+       (operating-system-swap-devices os)))
 
 (define* (system-linux-image-file-name #:optional
                                        (target (or (%current-target-system)