diff --git a/nix/libstore/builtins.cc b/nix/libstore/builtins.cc index 7ed75e5079..a5ebb47737 100644 --- a/nix/libstore/builtins.cc +++ b/nix/libstore/builtins.cc @@ -21,6 +21,7 @@ #include #include +#include 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. */