services: Add 'auto-start?' field to <service>.

* gnu/services.scm (<service>)[auto-start?]: New field.
* gnu/services/dmd.scm (dmd-configuration-file): Honor it.
* gnu/system/install.scm (cow-store-service): Add 'auto-start?' field.
This commit is contained in:
Ludovic Courtès 2014-11-10 23:23:32 +01:00
parent 03920078d5
commit fdaacbad85
3 changed files with 10 additions and 1 deletions

View file

@ -27,6 +27,7 @@ (define-module (gnu services)
service-respawn? service-respawn?
service-start service-start
service-stop service-stop
service-auto-start?
service-activate service-activate
service-user-accounts service-user-accounts
service-user-groups service-user-groups
@ -51,6 +52,8 @@ (define-record-type* <service>
(start service-start) ; g-expression (procedure) (start service-start) ; g-expression (procedure)
(stop service-stop ; g-expression (procedure) (stop service-stop ; g-expression (procedure)
(default #~(const #f))) (default #~(const #f)))
(auto-start? service-auto-start? ; Boolean
(default #t))
(user-accounts service-user-accounts ; list of <user-account> (user-accounts service-user-accounts ; list of <user-account>
(default '())) (default '()))
(user-groups service-user-groups ; list of <user-groups> (user-groups service-user-groups ; list of <user-groups>

View file

@ -68,7 +68,9 @@ (define config
(setenv "PATH" "/run/current-system/profile/bin") (setenv "PATH" "/run/current-system/profile/bin")
(format #t "starting services...~%") (format #t "starting services...~%")
(for-each start '#$(append-map service-provision services)))) (for-each start
'#$(append-map service-provision
(filter service-auto-start? services)))))
(gexp->file "dmd.conf" config))) (gexp->file "dmd.conf" config)))

View file

@ -102,6 +102,10 @@ (define (cow-store-service)
(documentation (documentation
"Make the store copy-on-write, with writes going to \ "Make the store copy-on-write, with writes going to \
the given target.") the given target.")
;; This is meant to be explicitly started by the user.
(auto-start? #f)
(start #~(case-lambda (start #~(case-lambda
((target) ((target)
#$(make-cow-store #~target) #$(make-cow-store #~target)