diff options
author | Griffin Smith <grfn@gws.fyi> | 2020-07-19T18·35-0400 |
---|---|---|
committer | glittershark <grfn@gws.fyi> | 2020-07-20T14·45+0000 |
commit | 2ef1060361b582990f6b7335e16ce37bee6756f2 (patch) | |
tree | 815cf23a4ff9c6343eca1a7c79b535ff1209aca0 /third_party/nix/src | |
parent | 31516eb9cde89824a58f4ebf30baaddc21ef9202 (diff) |
chore(3p/nix): Remove support for plugins r/1408
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 <hi@alyssa.is> Reviewed-by: isomer <isomer@tvl.fyi>
Diffstat (limited to 'third_party/nix/src')
-rw-r--r-- | third_party/nix/src/build-remote/build-remote.cc | 2 | ||||
-rw-r--r-- | third_party/nix/src/libexpr/primops.hh | 4 | ||||
-rw-r--r-- | third_party/nix/src/libmain/shared.hh | 1 | ||||
-rw-r--r-- | third_party/nix/src/libstore/globals.cc | 31 | ||||
-rw-r--r-- | third_party/nix/src/libstore/globals.hh | 10 | ||||
-rw-r--r-- | third_party/nix/src/nix-build/nix-build.cc | 2 | ||||
-rw-r--r-- | third_party/nix/src/nix-channel/nix-channel.cc | 2 | ||||
-rw-r--r-- | third_party/nix/src/nix-collect-garbage/nix-collect-garbage.cc | 2 | ||||
-rw-r--r-- | third_party/nix/src/nix-copy-closure/nix-copy-closure.cc | 2 | ||||
-rw-r--r-- | third_party/nix/src/nix-daemon/nix-daemon.cc | 2 | ||||
-rw-r--r-- | third_party/nix/src/nix-env/nix-env.cc | 2 | ||||
-rw-r--r-- | third_party/nix/src/nix-instantiate/nix-instantiate.cc | 2 | ||||
-rw-r--r-- | third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc | 2 | ||||
-rw-r--r-- | third_party/nix/src/nix-store/nix-store.cc | 2 | ||||
-rw-r--r-- | third_party/nix/src/nix/main.cc | 2 |
15 files changed, 1 insertions, 67 deletions
diff --git a/third_party/nix/src/build-remote/build-remote.cc b/third_party/nix/src/build-remote/build-remote.cc index 2c7e6dbab8cf..82ac2014ef75 100644 --- a/third_party/nix/src/build-remote/build-remote.cc +++ b/third_party/nix/src/build-remote/build-remote.cc @@ -68,8 +68,6 @@ static int _main(int argc, char* argv[]) { settings.maxBuildJobs.set("1"); // hack to make tests with local?root= work - initPlugins(); - auto store = openStore().cast<LocalStore>(); /* It would be more appropriate to use $XDG_RUNTIME_DIR, since diff --git a/third_party/nix/src/libexpr/primops.hh b/third_party/nix/src/libexpr/primops.hh index 45f63a541911..388066f39010 100644 --- a/third_party/nix/src/libexpr/primops.hh +++ b/third_party/nix/src/libexpr/primops.hh @@ -14,9 +14,7 @@ struct RegisterPrimOp { RegisterPrimOp(const std::string& name, size_t arity, PrimOpFun fun); }; -/* These primops are disabled without enableNativeCode, but plugins - may wish to use them in limited contexts without globally enabling - them. */ +/* These primops are disabled without enableNativeCode */ /* Load a ValueInitializer from a DSO and return whatever it initializes */ void prim_importNative(EvalState& state, const Pos& pos, Value** args, Value& v); diff --git a/third_party/nix/src/libmain/shared.hh b/third_party/nix/src/libmain/shared.hh index b749b572c560..60a9e302ff5a 100644 --- a/third_party/nix/src/libmain/shared.hh +++ b/third_party/nix/src/libmain/shared.hh @@ -22,7 +22,6 @@ class Exit : public std::exception { int handleExceptions(const std::string& programName, const std::function<void()>& fun); -/* Don't forget to call initPlugins() after settings are initialized! */ void initNix(); void parseCmdLine( diff --git a/third_party/nix/src/libstore/globals.cc b/third_party/nix/src/libstore/globals.cc index dccf8d9815a7..06ef3dd0402a 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 567ec6c42b6c..7799ff28502f 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<uint64_t> minFreeCheckInterval{ this, 5, "min-free-check-interval", "Number of seconds between checking free disk space."}; - - Setting<Paths> 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; diff --git a/third_party/nix/src/nix-build/nix-build.cc b/third_party/nix/src/nix-build/nix-build.cc index 7e3ee11d68f0..7ebb14e1f319 100644 --- a/third_party/nix/src/nix-build/nix-build.cc +++ b/third_party/nix/src/nix-build/nix-build.cc @@ -255,8 +255,6 @@ static void _main(int argc, char** argv) { myArgs.parseCmdline(args); - initPlugins(); - if (packages && fromArgs) { throw UsageError("'-p' and '-E' are mutually exclusive"); } diff --git a/third_party/nix/src/nix-channel/nix-channel.cc b/third_party/nix/src/nix-channel/nix-channel.cc index 87cc0a1fea87..837fb861d309 100644 --- a/third_party/nix/src/nix-channel/nix-channel.cc +++ b/third_party/nix/src/nix-channel/nix-channel.cc @@ -214,8 +214,6 @@ static int _main(int argc, char** argv) { return true; }); - initPlugins(); - switch (cmd) { case cNone: throw UsageError("no command specified"); diff --git a/third_party/nix/src/nix-collect-garbage/nix-collect-garbage.cc b/third_party/nix/src/nix-collect-garbage/nix-collect-garbage.cc index f6897595cbab..ac8c7d9399fb 100644 --- a/third_party/nix/src/nix-collect-garbage/nix-collect-garbage.cc +++ b/third_party/nix/src/nix-collect-garbage/nix-collect-garbage.cc @@ -82,8 +82,6 @@ static int _main(int argc, char** argv) { return true; }); - initPlugins(); - auto profilesDir = settings.nixStateDir + "/profiles"; if (removeOld) { removeOldGenerations(profilesDir); diff --git a/third_party/nix/src/nix-copy-closure/nix-copy-closure.cc b/third_party/nix/src/nix-copy-closure/nix-copy-closure.cc index d4ea6a85eca7..3dbe29f2240f 100644 --- a/third_party/nix/src/nix-copy-closure/nix-copy-closure.cc +++ b/third_party/nix/src/nix-copy-closure/nix-copy-closure.cc @@ -48,8 +48,6 @@ static int _main(int argc, char** argv) { return true; }); - initPlugins(); - if (sshHost.empty()) { throw UsageError("no host name specified"); } diff --git a/third_party/nix/src/nix-daemon/nix-daemon.cc b/third_party/nix/src/nix-daemon/nix-daemon.cc index 5296199380b3..dc5295821f84 100644 --- a/third_party/nix/src/nix-daemon/nix-daemon.cc +++ b/third_party/nix/src/nix-daemon/nix-daemon.cc @@ -1107,8 +1107,6 @@ static int _main(int argc, char** argv) { return true; }); - initPlugins(); - if (stdio) { if (getStoreType() == tDaemon) { /* Forward on this connection to the real daemon */ diff --git a/third_party/nix/src/nix-env/nix-env.cc b/third_party/nix/src/nix-env/nix-env.cc index 820b8cbcaf02..585cfbe3f722 100644 --- a/third_party/nix/src/nix-env/nix-env.cc +++ b/third_party/nix/src/nix-env/nix-env.cc @@ -1496,8 +1496,6 @@ static int _main(int argc, char** argv) { myArgs.parseCmdline(argvToStrings(argc, argv)); - initPlugins(); - if (op == nullptr) { throw UsageError("no operation specified"); } diff --git a/third_party/nix/src/nix-instantiate/nix-instantiate.cc b/third_party/nix/src/nix-instantiate/nix-instantiate.cc index 6c77a96ebc07..be96943b1234 100644 --- a/third_party/nix/src/nix-instantiate/nix-instantiate.cc +++ b/third_party/nix/src/nix-instantiate/nix-instantiate.cc @@ -153,8 +153,6 @@ static int _main(int argc, char** argv) { myArgs.parseCmdline(argvToStrings(argc, argv)); - initPlugins(); - if (evalOnly && !wantsReadWrite) { settings.readOnlyMode = true; } diff --git a/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc b/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc index b9de2e826b8e..dc0dce345bcd 100644 --- a/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc +++ b/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc @@ -100,8 +100,6 @@ static int _main(int argc, char** argv) { myArgs.parseCmdline(argvToStrings(argc, argv)); - initPlugins(); - if (args.size() > 2) { throw UsageError("too many arguments"); } diff --git a/third_party/nix/src/nix-store/nix-store.cc b/third_party/nix/src/nix-store/nix-store.cc index a642780b72e8..7729945b1307 100644 --- a/third_party/nix/src/nix-store/nix-store.cc +++ b/third_party/nix/src/nix-store/nix-store.cc @@ -1276,8 +1276,6 @@ static int _main(int argc, char** argv) { return true; }); - initPlugins(); - if (op == nullptr) { throw UsageError("no operation specified"); } diff --git a/third_party/nix/src/nix/main.cc b/third_party/nix/src/nix/main.cc index a7b6e71bbe93..5536aac53298 100644 --- a/third_party/nix/src/nix/main.cc +++ b/third_party/nix/src/nix/main.cc @@ -144,8 +144,6 @@ void mainWrapped(int argc, char** argv) { args.parseCmdline(argvToStrings(argc, argv)); - initPlugins(); - if (!args.command) { args.showHelpAndExit(); } |