summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/services.scm5
-rw-r--r--gnu/system.scm11
2 files changed, 15 insertions, 1 deletions
diff --git a/gnu/services.scm b/gnu/services.scm
index 8b89b11b8f..6bb21722b6 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -26,6 +26,7 @@
             service-respawn?
             service-start
             service-stop
+            service-activate
             service-user-accounts
             service-user-groups
             service-pam-services))
@@ -54,6 +55,8 @@
   (user-groups   service-user-groups              ; list of <user-groups>
                  (default '()))
   (pam-services  service-pam-services             ; list of <pam-service>
-                 (default '())))
+                 (default '()))
+  (activate      service-activate                 ; gexp
+                 (default #f)))
 
 ;;; services.scm ends here.
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)))))