aboutsummaryrefslogtreecommitdiff
path: root/src/nix/make-content-addressable.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix/make-content-addressable.cc')
-rw-r--r--src/nix/make-content-addressable.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/nix/make-content-addressable.cc b/src/nix/make-content-addressable.cc
index df3ec5194..5165c4804 100644
--- a/src/nix/make-content-addressable.cc
+++ b/src/nix/make-content-addressable.cc
@@ -23,17 +23,15 @@ struct CmdMakeContentAddressable : StorePathsCommand, MixJSON
return {
Example{
"To create a content-addressable representation of GNU Hello (but not its dependencies):",
- "nix make-content-addressable nixpkgs#hello"
+ "nix store make-content-addressable nixpkgs#hello"
},
Example{
"To compute a content-addressable representation of the current NixOS system closure:",
- "nix make-content-addressable -r /run/current-system"
+ "nix store make-content-addressable -r /run/current-system"
},
};
}
- Category category() override { return catUtility; }
-
void run(ref<Store> store, StorePaths storePaths) override
{
auto paths = store->topoSortPaths(StorePathSet(storePaths.begin(), storePaths.end()));
@@ -73,7 +71,7 @@ struct CmdMakeContentAddressable : StorePathsCommand, MixJSON
*sink.s = rewriteStrings(*sink.s, rewrites);
HashModuloSink hashModuloSink(htSHA256, oldHashPart);
- hashModuloSink((unsigned char *) sink.s->data(), sink.s->size());
+ hashModuloSink(*sink.s);
auto narHash = hashModuloSink.finish().first;
@@ -90,11 +88,11 @@ struct CmdMakeContentAddressable : StorePathsCommand, MixJSON
};
if (!json)
- printInfo("rewrote '%s' to '%s'", pathS, store->printStorePath(info.path));
+ notice("rewrote '%s' to '%s'", pathS, store->printStorePath(info.path));
auto source = sinkToSource([&](Sink & nextSink) {
RewritingSink rsink2(oldHashPart, std::string(info.path.hashPart()), nextSink);
- rsink2((unsigned char *) sink.s->data(), sink.s->size());
+ rsink2(*sink.s);
rsink2.flush();
});
@@ -108,4 +106,4 @@ struct CmdMakeContentAddressable : StorePathsCommand, MixJSON
}
};
-static auto rCmdMakeContentAddressable = registerCommand<CmdMakeContentAddressable>("make-content-addressable");
+static auto rCmdMakeContentAddressable = registerCommand2<CmdMakeContentAddressable>({"store", "make-content-addressable"});