From 2ef1060361b582990f6b7335e16ce37bee6756f2 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 19 Jul 2020 14:35:05 -0400 Subject: chore(3p/nix): Remove support for plugins Plugins seem to not really be used anywhere (I can find one plugin that's actually defined, and it doesn't seem very useful, especially since we got rid of builtins.exec) and their presence is adding additional complexity and potential sources of bugs to an already unsteady refactor. At some point we may want to bring back something *like* plugins, but their design will likely be different and it will definitely be after we have a functioning Nix again. Change-Id: I3bc40e55917f70bf260fbc208c1705e2e6a7c626 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1291 Tested-by: BuildkiteCI Reviewed-by: Alyssa Ross Reviewed-by: isomer --- third_party/nix/src/libstore/globals.cc | 31 ------------------------------- third_party/nix/src/libstore/globals.hh | 10 ---------- 2 files changed, 41 deletions(-) (limited to 'third_party/nix/src/libstore') diff --git a/third_party/nix/src/libstore/globals.cc b/third_party/nix/src/libstore/globals.cc index dccf8d9815..06ef3dd040 100644 --- a/third_party/nix/src/libstore/globals.cc +++ b/third_party/nix/src/libstore/globals.cc @@ -167,35 +167,4 @@ void MaxBuildJobsSetting::set(const std::string& str) { } } -void initPlugins() { - for (const auto& pluginFile : settings.pluginFiles.get()) { - Paths pluginFiles; - try { - auto ents = readDirectory(pluginFile); - for (const auto& ent : ents) { - pluginFiles.emplace_back(pluginFile + "/" + ent.name); - } - } catch (SysError& e) { - if (e.errNo != ENOTDIR) { - throw; - } - pluginFiles.emplace_back(pluginFile); - } - for (const auto& file : pluginFiles) { - /* handle is purposefully leaked as there may be state in the - DSO needed by the action of the plugin. */ - void* handle = dlopen(file.c_str(), RTLD_LAZY | RTLD_LOCAL); - if (handle == nullptr) { - throw Error("could not dynamically open plugin file '%s': %s", file, - dlerror()); - } - } - } - - /* Since plugins can add settings, try to re-apply previously - unknown settings. */ - globalConfig.reapplyUnknownSettings(); - globalConfig.warnUnknownSettings(); -} - } // namespace nix diff --git a/third_party/nix/src/libstore/globals.hh b/third_party/nix/src/libstore/globals.hh index 567ec6c42b..7799ff2850 100644 --- a/third_party/nix/src/libstore/globals.hh +++ b/third_party/nix/src/libstore/globals.hh @@ -452,21 +452,11 @@ class Settings : public Config { Setting minFreeCheckInterval{ this, 5, "min-free-check-interval", "Number of seconds between checking free disk space."}; - - Setting pluginFiles{ - this, - {}, - "plugin-files", - "Plugins to dynamically load at nix initialization time."}; }; // FIXME: don't use a global variable. extern Settings settings; -/* This should be called after settings are initialized, but before - anything else */ -void initPlugins(); - void loadConfFile(); extern const std::string nixVersion; -- cgit 1.4.1