aboutsummaryrefslogtreecommitdiff
path: root/src/nix/main.cc
diff options
context:
space:
mode:
authorjade <lix@jade.fyi>2024-10-09 20:37:58 +0000
committerGerrit Code Review <gerrit@localhost>2024-10-09 20:37:58 +0000
commit9865ebaaa618d82a7b7fdccc636cbaa7dfa42427 (patch)
treeb79db30394a892e7e6b7e0a2f966081b4a366590 /src/nix/main.cc
parent7f7a38f2788ba7fa46cf38127f525700cf63e153 (diff)
parentb63d4a0c622fa556695e7666b9b3bde920904920 (diff)
Merge "Remove static initializers for `RegisterLegacyCommand`" into main
Diffstat (limited to 'src/nix/main.cc')
-rw-r--r--src/nix/main.cc30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/nix/main.cc b/src/nix/main.cc
index 4a3a7b4e7..fdd3ac2ae 100644
--- a/src/nix/main.cc
+++ b/src/nix/main.cc
@@ -15,6 +15,17 @@
#include "markdown.hh"
#include "experimental-features-json.hh"
#include "deprecated-features-json.hh"
+#include "build-remote.hh"
+#include "daemon-command.hh"
+#include "hash-command.hh"
+#include "nix-build.hh"
+#include "nix-channel.hh"
+#include "nix-collect-garbage.hh"
+#include "nix-copy-closure.hh"
+#include "nix-env.hh"
+#include "nix-instantiate.hh"
+#include "nix-store.hh"
+#include "prefetch-command.hh"
#include <sys/types.h>
#include <sys/socket.h>
@@ -30,6 +41,21 @@ void chrootHelper(int argc, char * * argv);
namespace nix {
+void registerLegacyCommands()
+{
+ registerNixEnv();
+ registerNixBuildAndNixShell();
+ registerNixInstantiate();
+ registerNixCopyClosure();
+ registerNixCollectGarbage();
+ registerNixChannel();
+ registerNixStore();
+ registerBuildRemote();
+ registerNixDaemon();
+ registerNixPrefetchUrl();
+ registerNixHash();
+}
+
static bool haveProxyEnvironmentVariables()
{
static const std::vector<std::string> proxyVariables = {
@@ -356,8 +382,10 @@ void mainWrapped(int argc, char * * argv)
// Clean up the progress bar if shown using --log-format in a legacy command too.
// Otherwise, this is a harmless no-op.
Finally f([] { logger->pause(); });
+
{
- auto legacy = (*RegisterLegacyCommand::commands)[programName];
+ registerLegacyCommands();
+ auto legacy = (*LegacyCommands::commands)[programName];
if (legacy) return legacy(argc, argv);
}