about summary refs log tree commit diff
path: root/src/libstore/store-api.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-11-30T18·35+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-11-30T18·35+0000
commit9cf1948993659cc394eccea5890e14df82eff8bb (patch)
tree60564d61d6f38a62b4e4b81d4918db2969a90a4d /src/libstore/store-api.cc
parent6ecb840fd118019f879de60007e13321b7c080d3 (diff)
* Skeleton of remote store implementation.
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r--src/libstore/store-api.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 3a07d1c73ca2..092d7f1e9405 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -1,5 +1,6 @@
 #include "store-api.hh"
 #include "globals.hh"
+#include "util.hh"
 
 
 namespace nix {
@@ -90,6 +91,7 @@ Path makeFixedOutputPath(bool recursive,
 
 
 #include "local-store.hh"
+#include "remote-store.hh"
 
 
 namespace nix {
@@ -100,7 +102,12 @@ boost::shared_ptr<StoreAPI> store;
 
 boost::shared_ptr<StoreAPI> openStore(bool reserveSpace)
 {
-    return boost::shared_ptr<StoreAPI>(new LocalStore(reserveSpace));
+    string mode = getEnv("NIX_REMOTE");
+    if (mode == "")
+        return boost::shared_ptr<StoreAPI>(new LocalStore(reserveSpace));
+    else if (mode == "slave")
+        return boost::shared_ptr<StoreAPI>(new RemoteStore());
+    else throw Error(format("invalid setting for NIX_REMOTE, `%1%'") % mode);
 }