about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/globals.cc16
-rw-r--r--src/libstore/globals.hh7
-rw-r--r--src/libstore/store-api.cc2
3 files changed, 24 insertions, 1 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index c6b508cbe82f..c5a4536ef2f7 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -161,6 +161,22 @@ void initPlugins()
                 throw Error("could not dynamically open plugin file '%s%': %s%", file, dlerror());
         }
     }
+    /* We handle settings registrations here, since plugins can add settings */
+    if (RegisterSetting::settingRegistrations) {
+        for (auto & registration : *RegisterSetting::settingRegistrations)
+            settings.addSetting(registration);
+        delete RegisterSetting::settingRegistrations;
+    }
+    settings.handleUnknownSettings();
+}
+
+RegisterSetting::SettingRegistrations * RegisterSetting::settingRegistrations;
+
+RegisterSetting::RegisterSetting(AbstractSetting * s)
+{
+    if (!settingRegistrations)
+        settingRegistrations = new SettingRegistrations;
+    settingRegistrations->emplace_back(s);
 }
 
 
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index 508084d08acb..1d019aab9d23 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -383,5 +383,12 @@ void initPlugins();
 
 extern const string nixVersion;
 
+struct RegisterSetting
+{
+    typedef std::vector<AbstractSetting *> SettingRegistrations;
+    static SettingRegistrations * settingRegistrations;
+    RegisterSetting(AbstractSetting * s);
+};
+
 
 }
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 4d43ef082d53..8830edcc3449 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -839,7 +839,7 @@ ref<Store> openStore(const std::string & uri_,
     for (auto fun : *RegisterStoreImplementation::implementations) {
         auto store = fun(uri, params);
         if (store) {
-            store->warnUnknownSettings();
+            store->handleUnknownSettings();
             return ref<Store>(store);
         }
     }