mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
Merge pull request #9805 from yshui/prefetch-unpack
Add --unpack to nix store prefetch-file
This commit is contained in:
commit
f51409cf98
1 changed files with 10 additions and 1 deletions
|
@ -262,6 +262,7 @@ struct CmdStorePrefetchFile : StoreCommand, MixJSON
|
||||||
{
|
{
|
||||||
std::string url;
|
std::string url;
|
||||||
bool executable = false;
|
bool executable = false;
|
||||||
|
bool unpack = false;
|
||||||
std::optional<std::string> name;
|
std::optional<std::string> name;
|
||||||
HashAlgorithm hashAlgo = HashAlgorithm::SHA256;
|
HashAlgorithm hashAlgo = HashAlgorithm::SHA256;
|
||||||
std::optional<Hash> expectedHash;
|
std::optional<Hash> expectedHash;
|
||||||
|
@ -294,6 +295,14 @@ struct CmdStorePrefetchFile : StoreCommand, MixJSON
|
||||||
.handler = {&executable, true},
|
.handler = {&executable, true},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addFlag({
|
||||||
|
.longName = "unpack",
|
||||||
|
.description =
|
||||||
|
"Unpack the archive (which must be a tarball or zip file) and add "
|
||||||
|
"the result to the Nix store.",
|
||||||
|
.handler = {&unpack, true},
|
||||||
|
});
|
||||||
|
|
||||||
expectArg("url", &url);
|
expectArg("url", &url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +319,7 @@ struct CmdStorePrefetchFile : StoreCommand, MixJSON
|
||||||
}
|
}
|
||||||
void run(ref<Store> store) override
|
void run(ref<Store> store) override
|
||||||
{
|
{
|
||||||
auto [storePath, hash] = prefetchFile(store, url, name, hashAlgo, expectedHash, false, executable);
|
auto [storePath, hash] = prefetchFile(store, url, name, hashAlgo, expectedHash, unpack, executable);
|
||||||
|
|
||||||
if (json) {
|
if (json) {
|
||||||
auto res = nlohmann::json::object();
|
auto res = nlohmann::json::object();
|
||||||
|
|
Loading…
Reference in a new issue