aboutsummaryrefslogtreecommitdiff
path: root/gnu/services/base.scm
diff options
context:
space:
mode:
authorJanneke Nieuwenhuizen <janneke@gnu.org>2023-06-15 07:27:34 +0200
committerJan (janneke) Nieuwenhuizen <janneke@gnu.org>2024-11-11 07:28:33 +0100
commita16c94446e81c65715825853b19e9dccf39225dc (patch)
treeb31fd24f056662bb761854236454792b51dd7943 /gnu/services/base.scm
parent6dbfe1a118dcded3a9d77f8321aa43fbdd255011 (diff)
downloadguix-a16c94446e81c65715825853b19e9dccf39225dc.tar.gz
guix-a16c94446e81c65715825853b19e9dccf39225dc.zip
system: hurd: Add swap-services to hurd-default-essential-services.
* gnu/services/base.scm (swap-service-type): Do not include 'udev' requirement for the Hurd. Use system* with "swapon", "swapoff" for the Hurd. * gnu/system.scm (hurd-default-essential-services): Add swap-services. * gnu/services/base.scm (swap-service-type): Change-Id: I1d4d445c614921752dc84aa0dd6ff42cdbf62aa8
Diffstat (limited to 'gnu/services/base.scm')
-rw-r--r--gnu/services/base.scm20
1 files changed, 13 insertions, 7 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 7b053ef784..6473e1a91a 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -44,6 +44,7 @@
#:autoload (guix diagnostics) (warning formatted-message &fix-hint)
#:autoload (guix i18n) (G_)
#:use-module (guix combinators)
+ #:use-module (guix utils)
#:use-module (gnu services)
#:use-module (gnu services admin)
#:use-module (gnu services shepherd)
@@ -2677,7 +2678,7 @@ NAME-udev-hardware."
(with-imported-modules (source-module-closure '((gnu build file-systems)))
(shepherd-service
(provision (list (swap->shepherd-service-name swap)))
- (requirement `(udev ,@requirements))
+ (requirement `(,@(if (target-hurd?) '() '(udev)) ,@requirements))
(documentation "Enable the given swap space.")
(modules `((gnu build file-systems)
,@%default-modules))
@@ -2685,16 +2686,21 @@ NAME-udev-hardware."
(let ((device #$device-lookup))
(and device
(begin
- (restart-on-EINTR (swapon device
- #$(if (swap-space? swap)
- (swap-space->flags-bit-mask
- swap)
- 0)))
+ #$(if (target-hurd?)
+ #~(system* "swapon" device)
+ #~(restart-on-EINTR
+ (swapon device
+ #$(if (swap-space? swap)
+ (swap-space->flags-bit-mask
+ swap)
+ 0))))
#t)))))
(stop #~(lambda _
(let ((device #$device-lookup))
(when device
- (restart-on-EINTR (swapoff device)))
+ #$(if (target-hurd?)
+ #~(system* "swapoff" device)
+ #~(restart-on-EINTR (swapoff device))))
#f)))
(respawn? #f))))
(description "Turn on the virtual memory swap area.")))