mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
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.
This commit is contained in:
parent
517830cc01
commit
55ccc388b7
2 changed files with 15 additions and 1 deletions
|
@ -26,6 +26,7 @@ (define-module (gnu services)
|
|||
service-respawn?
|
||||
service-start
|
||||
service-stop
|
||||
service-activate
|
||||
service-user-accounts
|
||||
service-user-groups
|
||||
service-pam-services))
|
||||
|
@ -54,6 +55,8 @@ (define-record-type* <service>
|
|||
(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.
|
||||
|
|
|
@ -357,7 +357,14 @@ (define %modules
|
|||
(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 @@ (define group-specs
|
|||
;; 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)))))
|
||||
|
||||
|
|
Loading…
Reference in a new issue