aboutsummaryrefslogtreecommitdiff
path: root/src/nix-collect-garbage
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-10-26 11:35:46 +0200
committerEelco Dolstra <edolstra@gmail.com>2018-10-26 12:54:00 +0200
commitf6a3dfe4e06980b2d060fd1a646cb5ca20f29779 (patch)
tree2b40b00a7283617f18e663e8cb10fda08a38fb93 /src/nix-collect-garbage
parentc47e14ee453f3054d4a7326d8efe9255458bd7fd (diff)
Merge all nix-* binaries into nix
These are all symlinks to 'nix' now, reducing the installed size by about ~1.7 MiB.
Diffstat (limited to 'src/nix-collect-garbage')
-rw-r--r--src/nix-collect-garbage/local.mk7
-rw-r--r--src/nix-collect-garbage/nix-collect-garbage.cc15
2 files changed, 9 insertions, 13 deletions
diff --git a/src/nix-collect-garbage/local.mk b/src/nix-collect-garbage/local.mk
deleted file mode 100644
index 02d14cf62..000000000
--- a/src/nix-collect-garbage/local.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-programs += nix-collect-garbage
-
-nix-collect-garbage_DIR := $(d)
-
-nix-collect-garbage_SOURCES := $(d)/nix-collect-garbage.cc
-
-nix-collect-garbage_LIBS = libmain libstore libutil libformat
diff --git a/src/nix-collect-garbage/nix-collect-garbage.cc b/src/nix-collect-garbage/nix-collect-garbage.cc
index 37fe22f48..d4060ac93 100644
--- a/src/nix-collect-garbage/nix-collect-garbage.cc
+++ b/src/nix-collect-garbage/nix-collect-garbage.cc
@@ -2,6 +2,7 @@
#include "profiles.hh"
#include "shared.hh"
#include "globals.hh"
+#include "legacy.hh"
#include <iostream>
#include <cerrno>
@@ -48,12 +49,10 @@ void removeOldGenerations(std::string dir)
}
}
-int main(int argc, char * * argv)
+static int _main(int argc, char * * argv)
{
- bool removeOld = false;
-
- return handleExceptions(argv[0], [&]() {
- initNix();
+ {
+ bool removeOld = false;
GCOptions options;
@@ -90,5 +89,9 @@ int main(int argc, char * * argv)
PrintFreed freed(true, results);
store->collectGarbage(options, results);
}
- });
+
+ return 0;
+ }
}
+
+static RegisterLegacyCommand s1("nix-collect-garbage", _main);