guix-commits
[Top][All Lists]
Advanced

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

01/02: daemon: Define 'NIX_STORE' before invoking 'guix perform-download


From: Ludovic Courtès
Subject: 01/02: daemon: Define 'NIX_STORE' before invoking 'guix perform-download'.
Date: Tue, 7 Feb 2017 13:54:08 +0000 (UTC)

civodul pushed a commit to branch master
in repository guix.

commit 328f7cbe435d79d61f57129d9e3ee90404d6bfda
Author: Ludovic Courtès <address@hidden>
Date:   Tue Feb 7 14:44:55 2017 +0100

    daemon: Define 'NIX_STORE' before invoking 'guix perform-download'.
    
    Reported by rohit yadav <address@hidden>
    at <https://lists.gnu.org/archive/html/guix-devel/2017-02/msg00191.html>.
    
    This fixes a regression whereby 'guix perform-download' would always see
    NIX_STORE as unset and thus use "/gnu/store", leading it to miscompute
    the hydra.gnu.org content-addressed URLs when the store file name is not
    "/gnu/store".
    
    * nix/libstore/builtins.cc (builtinDownload): Add 'setenv' call for
    'NIX_STORE'.
---
 nix/libstore/builtins.cc |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/nix/libstore/builtins.cc b/nix/libstore/builtins.cc
index 7ed75e5..a5ebb47 100644
--- a/nix/libstore/builtins.cc
+++ b/nix/libstore/builtins.cc
@@ -21,6 +21,7 @@
 #include <globals.hh>
 
 #include <unistd.h>
+#include <cstdlib>
 
 namespace nix {
 
@@ -41,6 +42,11 @@ static void builtinDownload(const Derivation &drv,
        "download", drvPath.c_str(), output.c_str(), NULL
       };
 
+    /* Tell the script what the store file name is, so that
+       'strip-store-file-name' (used for instance to determine the URL of
+       content-addressed mirrors) works correctly.  */
+    setenv("NIX_STORE", settings.nixStore.c_str(), 1);
+
     /* XXX: Hack our way to use the 'download' script from 'LIBEXECDIR/guix'
        or just 'LIBEXECDIR', depending on whether we're running uninstalled or
        not.  */



reply via email to

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