all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sergey Trofimov <sarg@sarg.org.ru>
To: 62274@debbugs.gnu.org
Cc: Sergey Trofimov <sarg@sarg.org.ru>,
	paren@disroot.org, andrew@trop.in, ludo@gnu.org
Subject: [bug#62274] [PATCH] home: 'home-environment-with-provenance' uses the HE location info.
Date: Sun, 19 Mar 2023 16:45:37 +0100	[thread overview]
Message-ID: <20230319154537.30463-1-sarg@sarg.org.ru> (raw)

* 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





             reply	other threads:[~2023-03-19 15:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-19 15:45 Sergey Trofimov [this message]
2023-03-20  6:52 ` bug#62274: [PATCH] home: 'home-environment-with-provenance' uses the HE location info 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230319154537.30463-1-sarg@sarg.org.ru \
    --to=sarg@sarg.org.ru \
    --cc=62274@debbugs.gnu.org \
    --cc=andrew@trop.in \
    --cc=ludo@gnu.org \
    --cc=paren@disroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.