guix-commits
[Top][All Lists]
Advanced

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

01/02: utils: Add NIX_STORE_DIR as a candidate for the value of the stor


From: guix-commits
Subject: 01/02: utils: Add NIX_STORE_DIR as a candidate for the value of the store directory.
Date: Tue, 26 Jan 2021 22:50:20 -0500 (EST)

apteryx pushed a commit to branch core-updates
in repository guix.

commit 47a6a938c3c4d0bbe7b6a3c64ff75d7bfb2f24fb
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Mon Jan 18 11:51:20 2021 -0500

    utils: Add NIX_STORE_DIR as a candidate for the value of the store 
directory.
    
    On the daemon side, nixStore gets set to the environment variable
    NIX_STORE_DIR, else the environment variable NIX_STORE else the compile time
    macro NIX_STORE_DIR (see the Settings::processEnvironment method in
    nix/libstore/globals.cc).  When creating a build environment, it sets
    NIX_STORE with the value computed as described above.  Hence, it's safer to
    look for both NIX_STORE_DIR and NIX_STORE in (guix build utils), so that it
    works in any context (build context or external context).
    
    * guix/build/utils.scm (%store-directory): Consider both NIX_STORE_DIR and
    NIX_STORE as environment variables.
---
 guix/build/utils.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 76180e6..6c40d70 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -144,7 +144,8 @@
 
 (define (%store-directory)
   "Return the directory name of the store."
-  (or (getenv "NIX_STORE")
+  (or (getenv "NIX_STORE_DIR")          ;outside of builder
+      (getenv "NIX_STORE")              ;inside builder, set by the daemon
       "/gnu/store"))
 
 (define (store-file-name? file)



reply via email to

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