guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/03: home: 'home-environment-with-provenance' uses the HE location inf


From: guix-commits
Subject: 03/03: home: 'home-environment-with-provenance' uses the HE location info.
Date: Mon, 20 Mar 2023 01:15:42 -0400 (EDT)

abcdw pushed a commit to branch master
in repository guix.

commit 1f36534c7e8f2325bff4df5d37ecc811dc63fc38
Author: Sergey Trofimov <sarg@sarg.org.ru>
AuthorDate: Sun Mar 19 16:45:37 2023 +0100

    home: 'home-environment-with-provenance' uses the HE location info.
    
    * gnu/home.scm (home-environment-with-provenance): Make `config-file`
    optional, with the default taken from the HE location info.
    
    Signed-off-by: Andrew Tropin <andrew@trop.in>
---
 gnu/home.scm | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/gnu/home.scm b/gnu/home.scm
index 6d3f705758..2fefe7ba53 100644
--- a/gnu/home.scm
+++ b/gnu/home.scm
@@ -103,7 +103,21 @@
                               #:target-type home-service-type)))
     (service-value home)))
 
-(define* (home-environment-with-provenance he config-file)
+
+(define (home-environment-configuration-file he)
+  "Return the configuration file of HE, based on its 'location' field, or #f
+if it could not be determined."
+  (let ((file (and=> (home-environment-location he)
+                     location-file)))
+    (and file
+         (or (and (string-prefix? "/" file) file)
+             (search-path %load-path file)))))
+
+(define* (home-environment-with-provenance he
+                                           #:optional
+                                           (config-file
+                                            
(home-environment-configuration-file
+                                             he)))
   "Return a variant of HE that stores its own provenance information,
 including CONFIG-FILE, if available.  This is achieved by adding an instance
 of HOME-PROVENANCE-SERVICE-TYPE to its services."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]