summary refs log tree commit diff
path: root/gnu/system.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-05-24 18:03:27 +0200
committerLudovic Courtès <ludo@gnu.org>2014-05-24 18:10:05 +0200
commit55ccc388b73312c9636857bb083f63a968b4255b (patch)
tree228705852da4d05e31095d54b3aea8be7294b207 /gnu/system.scm
parent517830cc0154dbe4a77741e7ee61703c194086a4 (diff)
downloadguix-55ccc388b73312c9636857bb083f63a968b4255b.tar.gz
services: Support per-service activation scripts.
* gnu/services.scm (<service>)[activate]: New field.
* gnu/system.scm (operating-system-activation-script)[service-activations]:
  New procedure.  Use it, and primitive-load each activation.
Diffstat (limited to 'gnu/system.scm')
-rw-r--r--gnu/system.scm11
1 files changed, 11 insertions, 0 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 1d708179bd..06bec40cef 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -357,7 +357,14 @@ etc."
       (guix build utils)
       (guix build linux-initrd)))
 
+  (define (service-activations services)
+    ;; Return the activation scripts for SERVICES.
+    (let ((gexps (filter-map service-activate services)))
+      (sequence %store-monad (map (cut gexp->file "activate-service.scm" <>)
+                                  gexps))))
+
   (mlet* %store-monad ((services (operating-system-services os))
+                       (actions  (service-activations services))
                        (etc      (operating-system-etc-directory os))
                        (modules  (imported-modules %modules))
                        (compiled (compiled-modules %modules))
@@ -398,6 +405,10 @@ etc."
                     ;; Activate setuid programs.
                     (activate-setuid-programs (list #$@setuid-progs))
 
+                    ;; Run the services' activation snippets.
+                    ;; TODO: Use 'load-compiled'.
+                    (for-each primitive-load '#$actions)
+
                     ;; Set up /run/current-system.
                     (activate-current-system)))))