aboutsummaryrefslogtreecommitdiff
path: root/src/nix/store-repair.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-01-13 23:27:39 +0100
committerEelco Dolstra <edolstra@gmail.com>2021-01-13 23:27:39 +0100
commit61216d32e1c0973424d549c9f3065426b51015c9 (patch)
treee16069deaa54cfd2cab8efcff22ce51a7070708d /src/nix/store-repair.cc
parent3da9a9241cb9f8c284426c220ea285398d0328dd (diff)
Add 'nix store repair' command
Diffstat (limited to 'src/nix/store-repair.cc')
-rw-r--r--src/nix/store-repair.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/nix/store-repair.cc b/src/nix/store-repair.cc
new file mode 100644
index 000000000..1c7a4392e
--- /dev/null
+++ b/src/nix/store-repair.cc
@@ -0,0 +1,27 @@
+#include "command.hh"
+#include "store-api.hh"
+
+using namespace nix;
+
+struct CmdStoreRepair : StorePathsCommand
+{
+ std::string description() override
+ {
+ return "repair store paths";
+ }
+
+ std::string doc() override
+ {
+ return
+ #include "store-repair.md"
+ ;
+ }
+
+ void run(ref<Store> store, std::vector<StorePath> storePaths) override
+ {
+ for (auto & path : storePaths)
+ store->repairPath(path);
+ }
+};
+
+static auto rStoreRepair = registerCommand2<CmdStoreRepair>({"store", "repair"});