aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/globals.cc
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-04 06:22:47 +0100
committereldritch horrors <pennae@lix.systems>2024-03-04 07:11:25 +0100
commit4018fcb9b8d622e7bac1310a689c90dac9109137 (patch)
treea1f1571a076242962b07449234b71b4c1e7c12d8 /src/libstore/globals.cc
parenta2d5e803cf16e048f30f0334114759f81f6c5d20 (diff)
Merge pull request #9233 from bouk/bouk/apply-config-inner
config: add included files into parsedContents before applying (cherry picked from commit 82359eba6b692691ef08a71196ef25a61bc4d3d3) Change-Id: Idde3177010fec7b8bafe6088c3c23d5caf491845
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");