diff options
author | Andrew Tropin <andrew@trop.in> | 2021-08-05 08:47:40 +0300 |
---|---|---|
committer | Oleg Pykhalov <go.wigust@gmail.com> | 2021-09-09 19:54:54 +0300 |
commit | 05093ffda2a6d07593958cb0dc8ea4406e52094c (patch) | |
tree | 7678a381d0230ad11f13fa7e6fd5d6c84a01c421 /gnu/home-services.scm | |
parent | 305edf9c3a2dcaabc5a5216fc401c676222a463a (diff) | |
download | guix-05093ffda2a6d07593958cb0dc8ea4406e52094c.tar.gz |
home-services: Add fold-home-service-types function.
* gnu/home-services.scm (parent-directory, %guix-home-root-directory, %service-type-path, all-home-service-modules, fold-home-service-types): New variables. Signed-off-by: Oleg Pykhalov <go.wigust@gmail.com>
Diffstat (limited to 'gnu/home-services.scm')
-rw-r--r-- | gnu/home-services.scm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gnu/home-services.scm b/gnu/home-services.scm index d320d3a44d..16b9736d64 100644 --- a/gnu/home-services.scm +++ b/gnu/home-services.scm @@ -492,3 +492,29 @@ environment, and its configuration file, when available."))) (define sexp->home-provenance sexp->system-provenance) (define home-provenance system-provenance) + + +;;; +;;; Searching +;;; + +(define (parent-directory directory) + "Get the parent directory of DIRECTORY" + (string-join (drop-right (string-split directory #\/) 1) "/")) + +(define %guix-home-root-directory + ;; Absolute file name of the module hierarchy. + (parent-directory (dirname (search-path %load-path "gnu/home-services.scm")))) + +(define %service-type-path + ;; Search path for service types. + (make-parameter `((,%guix-home-root-directory . "gnu/home-services")))) + +(define (all-home-service-modules) + "Return the default set of home-service modules." + (cons (resolve-interface '(gnu home-services)) + (all-modules (%service-type-path) + #:warn warn-about-load-error))) + +(define* (fold-home-service-types proc seed) + (fold-service-types proc seed (all-home-service-modules))) |