aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/globals.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/globals.cc')
-rw-r--r--src/libstore/globals.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 9c25d9868..0aecd2b6a 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -111,7 +111,14 @@ Settings::Settings()
void loadConfFile()
{
- globalConfig.applyConfigFile(settings.nixConfDir + "/nix.conf");
+ auto applyConfigFile = [&](const Path & path) {
+ try {
+ std::string contents = readFile(path);
+ globalConfig.applyConfig(contents, path);
+ } catch (SysError &) { }
+ };
+
+ applyConfigFile(settings.nixConfDir + "/nix.conf");
/* We only want to send overrides to the daemon, i.e. stuff from
~/.nix/nix.conf or the command line. */
@@ -119,7 +126,7 @@ void loadConfFile()
auto files = settings.nixUserConfFiles;
for (auto file = files.rbegin(); file != files.rend(); file++) {
- globalConfig.applyConfigFile(*file);
+ applyConfigFile(*file);
}
auto nixConfEnv = getEnv("NIX_CONFIG");