mirror of
https://github.com/NixOS/nix
synced 2025-06-27 08:31:16 +02:00
Move BinaryCacheStore / LocalBinaryCacheStore from Hydra
So you can now do: $ NIX_REMOTE=file:///tmp/binary-cache nix-store -qR /nix/store/...
This commit is contained in:
parent
b584a0e7de
commit
263187a2ec
7 changed files with 658 additions and 5 deletions
|
@ -313,18 +313,24 @@ void Store::exportPaths(const Paths & paths,
|
|||
|
||||
|
||||
#include "local-store.hh"
|
||||
#include "serialise.hh"
|
||||
#include "remote-store.hh"
|
||||
#include "local-binary-cache-store.hh"
|
||||
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
||||
ref<Store> openStore(bool reserveSpace)
|
||||
ref<Store> openStoreAt(const std::string & uri, bool reserveSpace)
|
||||
{
|
||||
if (std::string(uri, 0, 7) == "file://") {
|
||||
return make_ref<LocalBinaryCacheStore>(std::shared_ptr<Store>(0),
|
||||
"", "", // FIXME: allow the signing key to be set
|
||||
std::string(uri, 7));
|
||||
}
|
||||
|
||||
enum { mDaemon, mLocal, mAuto } mode;
|
||||
|
||||
mode = getEnv("NIX_REMOTE") == "daemon" ? mDaemon : mAuto;
|
||||
mode = uri == "daemon" ? mDaemon : mAuto;
|
||||
|
||||
if (mode == mAuto) {
|
||||
if (LocalStore::haveWriteAccess())
|
||||
|
@ -341,4 +347,10 @@ ref<Store> openStore(bool reserveSpace)
|
|||
}
|
||||
|
||||
|
||||
ref<Store> openStore(bool reserveSpace)
|
||||
{
|
||||
return openStoreAt(getEnv("NIX_REMOTE"), reserveSpace);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue