From 031d70e5009fcce58afabc9113d5a5de4a16b19a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 1 May 2017 17:35:30 +0200 Subject: Support arbitrary store URIs in nix.machines For backwards compatibility, if the URI is just a hostname, ssh:// (i.e. LegacySSHStore) is prepended automatically. Also, all fields except the URI are now optional. For example, this is a valid nix.machines file: local?root=/tmp/nix This is useful for testing the remote build machinery since you don't have to mess around with ssh. --- src/libstore/store-api.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/libstore/store-api.cc') diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 850ea211dd50..75de4c933234 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -709,10 +709,11 @@ namespace nix { RegisterStoreImplementation::Implementations * RegisterStoreImplementation::implementations = 0; -ref openStore(const std::string & uri_) +ref openStore(const std::string & uri_, + const Store::Params & extraParams) { auto uri(uri_); - Store::Params params; + Store::Params params(extraParams); auto q = uri.find('?'); if (q != std::string::npos) { for (auto s : tokenizeString(uri.substr(q + 1), "&")) { @@ -722,11 +723,7 @@ ref openStore(const std::string & uri_) } uri = uri_.substr(0, q); } - return openStore(uri, params); -} -ref openStore(const std::string & uri, const Store::Params & params) -{ for (auto fun : *RegisterStoreImplementation::implementations) { auto store = fun(uri, params); if (store) { @@ -735,7 +732,7 @@ ref openStore(const std::string & uri, const Store::Params & params) } } - throw Error(format("don't know how to open Nix store ā€˜%sā€™") % uri); + throw Error("don't know how to open Nix store ā€˜%sā€™", uri); } -- cgit 1.4.1