Turn $NIX_REMOTE into a configuration option
This commit is contained in:
parent
38dcd0c4b8
commit
f32cdc4fab
4 changed files with 8 additions and 7 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "types.hh"
|
#include "types.hh"
|
||||||
#include "config.hh"
|
#include "config.hh"
|
||||||
|
#include "util.hh"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
@ -84,6 +85,9 @@ public:
|
||||||
/* File name of the socket the daemon listens to. */
|
/* File name of the socket the daemon listens to. */
|
||||||
Path nixDaemonSocketFile;
|
Path nixDaemonSocketFile;
|
||||||
|
|
||||||
|
Setting<std::string> storeUri{this, getEnv("NIX_REMOTE", "auto"), "store",
|
||||||
|
"The default Nix store to use."};
|
||||||
|
|
||||||
Setting<bool> keepFailed{this, false, "keep-failed",
|
Setting<bool> keepFailed{this, false, "keep-failed",
|
||||||
"Whether to keep temporary directories of failed builds."};
|
"Whether to keep temporary directories of failed builds."};
|
||||||
|
|
||||||
|
|
|
@ -716,7 +716,7 @@ void removeTempRoots();
|
||||||
You can pass parameters to the store implementation by appending
|
You can pass parameters to the store implementation by appending
|
||||||
‘?key=value&key=value&...’ to the URI.
|
‘?key=value&key=value&...’ to the URI.
|
||||||
*/
|
*/
|
||||||
ref<Store> openStore(const std::string & uri = getEnv("NIX_REMOTE"),
|
ref<Store> openStore(const std::string & uri = settings.storeUri.get(),
|
||||||
const Store::Params & extraParams = Store::Params());
|
const Store::Params & extraParams = Store::Params());
|
||||||
|
|
||||||
|
|
||||||
|
@ -727,7 +727,8 @@ enum StoreType {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
StoreType getStoreType(const std::string & uri = getEnv("NIX_REMOTE"), const std::string & stateDir = settings.nixStateDir);
|
StoreType getStoreType(const std::string & uri = settings.storeUri.get(),
|
||||||
|
const std::string & stateDir = settings.nixStateDir);
|
||||||
|
|
||||||
/* Return the default substituter stores, defined by the
|
/* Return the default substituter stores, defined by the
|
||||||
‘substituters’ option and various legacy options like
|
‘substituters’ option and various legacy options like
|
||||||
|
|
|
@ -78,9 +78,6 @@ bool MultiCommand::processArgs(const Strings & args, bool finish)
|
||||||
|
|
||||||
StoreCommand::StoreCommand()
|
StoreCommand::StoreCommand()
|
||||||
{
|
{
|
||||||
storeUri = getEnv("NIX_REMOTE");
|
|
||||||
|
|
||||||
mkFlag(0, "store", "store-uri", "URI of the Nix store to use", &storeUri);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ref<Store> StoreCommand::getStore()
|
ref<Store> StoreCommand::getStore()
|
||||||
|
@ -92,7 +89,7 @@ ref<Store> StoreCommand::getStore()
|
||||||
|
|
||||||
ref<Store> StoreCommand::createStore()
|
ref<Store> StoreCommand::createStore()
|
||||||
{
|
{
|
||||||
return openStore(storeUri);
|
return openStore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StoreCommand::run()
|
void StoreCommand::run()
|
||||||
|
|
|
@ -33,7 +33,6 @@ class Store;
|
||||||
/* A command that require a Nix store. */
|
/* A command that require a Nix store. */
|
||||||
struct StoreCommand : virtual Command
|
struct StoreCommand : virtual Command
|
||||||
{
|
{
|
||||||
std::string storeUri;
|
|
||||||
StoreCommand();
|
StoreCommand();
|
||||||
void run() override;
|
void run() override;
|
||||||
ref<Store> getStore();
|
ref<Store> getStore();
|
||||||
|
|
Loading…
Reference in a new issue