unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#62274] [PATCH] home: 'home-environment-with-provenance' uses the HE location info.
@ 2023-03-19 15:45 Sergey Trofimov
  2023-03-20  6:52 ` bug#62274: " Andrew Tropin
  2023-03-20 17:33 ` [bug#62274] " Ludovic Courtès
  0 siblings, 2 replies; 9+ messages in thread
From: Sergey Trofimov @ 2023-03-19 15:45 UTC (permalink / raw)
  To: 62274; +Cc: Sergey Trofimov, paren, andrew, ludo

* gnu/home.scm (home-environment-with-provenance): Make `config-file`
optional, with the default taken from the HE location info.
---
 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 @@ (define* (home-environment-derivation he)
                               #: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."
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-03-21 19:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-19 15:45 [bug#62274] [PATCH] home: 'home-environment-with-provenance' uses the HE location info Sergey Trofimov
2023-03-20  6:52 ` bug#62274: " Andrew Tropin
2023-03-20 17:33 ` [bug#62274] " Ludovic Courtès
2023-03-20 19:03   ` Sergey Trofimov
2023-03-21  9:44     ` Ludovic Courtès
2023-03-21 10:56     ` Andrew Tropin
2023-03-21 12:22       ` Sergey Trofimov
2023-03-21 13:38         ` Andrew Tropin
2023-03-21 18:18           ` Sergey Trofimov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).