summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-05-11 00:19:06 +0200
committerLudovic Courtès <ludo@gnu.org>2019-05-11 20:10:26 +0200
commit48d498c2c3984784336b27ba5e261319f3ac6a3a (patch)
treebe78f982b3bc1d87a78493758dcee1180e5076cd
parente247244e00aefa4fb71b714d859a2d1528019706 (diff)
downloadguix-48d498c2c3984784336b27ba5e261319f3ac6a3a.tar.gz
build-self: Let HOME pass through the execution environment.
Fixes <https://bugs.gnu.org/35623>.
Reported by Karrick McDermott <kmcdermott@linkedin.com>.

* build-aux/build-self.scm (build): Add 'getenv' and 'setenv' calls for
HOME.
-rw-r--r--build-aux/build-self.scm4
1 files changed, 4 insertions, 0 deletions
diff --git a/build-aux/build-self.scm b/build-aux/build-self.scm
index 1ddd2233b0..8eb61623f4 100644
--- a/build-aux/build-self.scm
+++ b/build-aux/build-self.scm
@@ -399,6 +399,7 @@ files."
   (mlet %store-monad ((build  (build-program source version guile-version
                                              #:pull-version pull-version))
                       (system (if system (return system) (current-system)))
+                      (home   (getenv "HOME"))
 
                       ;; Note: Use the deprecated names here because the
                       ;; caller might be Guix <= 0.16.0.
@@ -419,6 +420,9 @@ files."
                          ;; $GUILE_LOAD_PATH & co.
                          (with-clean-environment
                           (setenv "GUILE_WARN_DEPRECATED" "no") ;be quiet and drive
+                          (when home
+                            ;; Inherit HOME so that 'xdg-directory' works.
+                            (setenv "HOME" home))
                           (open-pipe* OPEN_READ
                                       (derivation->output-path build)
                                       source system version