From f05d5f89ff4ec52ed2f6d576b2b2323b5292f815 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 20 Apr 2017 14:58:16 +0200 Subject: Read per-user settings from ~/.config/nix/nix.conf --- src/libstore/globals.cc | 12 ++++++------ src/libstore/globals.hh | 4 ---- src/libstore/remote-store.cc | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) (limited to 'src/libstore') diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index bb61daa51..6b9d07746 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -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()); diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh index de64e9826..d3ecaadb6 100644 --- a/src/libstore/globals.hh +++ b/src/libstore/globals.hh @@ -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. */ diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index da3c8eb8d..bc9ef3d47 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -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; -- cgit v1.2.3