diff options
author | Marius Bakke <mbakke@fastmail.com> | 2017-09-20 18:49:26 +0200 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2017-09-20 18:49:26 +0200 |
commit | 58366883f2f1516a4a02f5b4e2a70e86481827b5 (patch) | |
tree | fa67d714c4596164b341118132728a48135f4759 /gnu/services.scm | |
parent | f40aef6b3b56e1e5fb6e6ac29bd372000e13982f (diff) | |
parent | 9a1c4a981bdd7eeca76aaf73a57d6841918821c2 (diff) | |
download | guix-58366883f2f1516a4a02f5b4e2a70e86481827b5.tar.gz |
Merge branch 'master' into staging
Diffstat (limited to 'gnu/services.scm')
-rw-r--r-- | gnu/services.scm | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/gnu/services.scm b/gnu/services.scm index 8ef1ae7c77..2ebd701a59 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -23,6 +23,7 @@ #:use-module (guix store) #:use-module (guix records) #:use-module (guix profiles) + #:use-module (guix discovery) #:use-module (guix sets) #:use-module (guix ui) #:use-module ((guix utils) #:select (source-properties->location)) @@ -49,6 +50,11 @@ service-type-compose service-type-extend service-type-default-value + service-type-description + service-type-location + + %service-type-path + fold-service-types service service? @@ -145,7 +151,15 @@ ;; Optional default value for instances of this type. (default-value service-type-default-value ;Any - (default &no-default-value))) + (default &no-default-value)) + + ;; Meta-data. + (description service-type-description ;string + (default #f)) + (location service-type-location ;<location> + (default (and=> (current-source-location) + source-properties->location)) + (innate))) (define (write-service-type type port) (format port "#<service-type ~a ~a>" @@ -154,6 +168,27 @@ (set-record-type-printer! <service-type> write-service-type) +(define %distro-root-directory + ;; Absolute file name of the module hierarchy. + (dirname (search-path %load-path "guix.scm"))) + +(define %service-type-path + ;; Search path for service types. + (make-parameter `((,%distro-root-directory . "gnu/services") + (,%distro-root-directory . "gnu/system")))) + +(define* (fold-service-types proc seed + #:optional + (modules (all-modules (%service-type-path)))) + "For each service type exported by one of MODULES, call (PROC RESULT). SEED +is used as the initial value of RESULT." + (fold-module-public-variables (lambda (object result) + (if (service-type? object) + (proc object result) + result)) + '() + modules)) + ;; Services of a given type. (define-record-type <service> (make-service type value) |