Read per-user settings from ~/.config/nix/nix.conf
This commit is contained in:
parent
562585e901
commit
f05d5f89ff
8 changed files with 70 additions and 24 deletions
|
|
@ -53,19 +53,19 @@ Settings::Settings()
|
|||
void Settings::loadConfFile()
|
||||
{
|
||||
applyConfigFile(nixConfDir + "/nix.conf");
|
||||
|
||||
/* We only want to send overrides to the daemon, i.e. stuff from
|
||||
~/.nix/nix.conf or the command line. */
|
||||
resetOverriden();
|
||||
|
||||
applyConfigFile(getConfigDir() + "/nix/nix.conf");
|
||||
}
|
||||
|
||||
void Settings::set(const string & name, const string & value)
|
||||
{
|
||||
overrides[name] = value;
|
||||
Config::set(name, value);
|
||||
}
|
||||
|
||||
StringMap Settings::getOverrides()
|
||||
{
|
||||
return overrides;
|
||||
}
|
||||
|
||||
unsigned int Settings::getDefaultCores()
|
||||
{
|
||||
return std::max(1U, std::thread::hardware_concurrency());
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ extern bool useCaseHack; // FIXME
|
|||
|
||||
class Settings : public Config {
|
||||
|
||||
StringMap overrides;
|
||||
|
||||
unsigned int getDefaultCores();
|
||||
|
||||
public:
|
||||
|
|
@ -27,8 +25,6 @@ public:
|
|||
|
||||
void set(const string & name, const string & value);
|
||||
|
||||
StringMap getOverrides();
|
||||
|
||||
Path nixPrefix;
|
||||
|
||||
/* The directory where we store sources and derived files. */
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ void RemoteStore::setOptions(Connection & conn)
|
|||
<< settings.useSubstitutes;
|
||||
|
||||
if (GET_PROTOCOL_MINOR(conn.daemonVersion) >= 12) {
|
||||
StringMap overrides = settings.getOverrides();
|
||||
auto overrides = settings.getSettings(true);
|
||||
conn.to << overrides.size();
|
||||
for (auto & i : overrides)
|
||||
conn.to << i.first << i.second;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue