GNU bug report logs - #49419
[PATCH 0/4] Essential home services

Previous Next

Package: guix-patches;

Reported by: Andrew Tropin <andrew <at> trop.in>

Date: Mon, 5 Jul 2021 15:36:01 UTC

Severity: normal

Tags: patch

Merged with 49546, 49547, 49548, 49549

Done: Oleg Pykhalov <go.wigust <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Andrew Tropin <andrew <at> trop.in>
To: 49419 <at> debbugs.gnu.org
Subject: [bug#49419] [PATCH v4 4/4] home-services: Add fold-home-service-types function
Date: Thu, 05 Aug 2021 08:47:40 +0300
[Message part 1 (text/plain, inline)]
* gnu/home-services.scm (parent-directory, %guix-home-root-directory,
%service-type-path, all-home-service-modules, fold-home-service-types): New
variables.
---
 gnu/home-services.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

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)))
-- 
2.32.0

[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 3 years and 271 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.