summary refs log tree commit diff
path: root/gnu/home
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2024-03-20 18:48:38 +0100
committerLudovic Courtès <ludo@gnu.org>2024-03-21 17:43:15 +0100
commit6f9d844d2ece7b369d17bbe678978462425f869c (patch)
tree71ba92a36c85e053e7c6c3910022d5914ad5f50c /gnu/home
parent2b052fe3c0fa85e9faa8873a581568ad4c78e151 (diff)
downloadguix-6f9d844d2ece7b369d17bbe678978462425f869c.tar.gz
services: shepherd: Load each service file in a fresh module.
Fixes <https://issues.guix.gnu.org/67649>.

* gnu/home/services/shepherd.scm (home-shepherd-configuration-file)[config]:
Define ‘make-user-module’.  Call ‘load’ in ‘save-module-excursion’.
* gnu/services/shepherd.scm (shepherd-configuration-file): Likewise.

Reported-by: Attila Lendvai <attila@lendvai.name>
Change-Id: I7df11c81b5bbbf2b24a8daa02502a000e0826fe0
Diffstat (limited to 'gnu/home')
-rw-r--r--gnu/home/services/shepherd.scm14
1 files changed, 13 insertions, 1 deletions
diff --git a/gnu/home/services/shepherd.scm b/gnu/home/services/shepherd.scm
index 176f4575cb..962e633618 100644
--- a/gnu/home/services/shepherd.scm
+++ b/gnu/home/services/shepherd.scm
@@ -77,7 +77,19 @@ as shepherd package."
           (use-modules (srfi srfi-34)
                        (system repl error-handling))
 
-          (register-services (map load '#$files))
+          (define (make-user-module)
+            ;; Copied from (shepherd support), where it's private.
+            (let ((m (make-fresh-user-module)))
+              (module-use! m (resolve-interface '(shepherd service)))
+              m))
+
+          (register-services
+           (map (lambda (file)
+                  (save-module-excursion
+                   (lambda ()
+                     (set-current-module (make-user-module))
+                     (load file))))
+                '#$files))
 
           #$@(if daemonize?
                  `((action 'root 'daemonize))