aboutsummaryrefslogtreecommitdiff
path: root/src/nix/upgrade-nix.cc
diff options
context:
space:
mode:
authorBen Burdette <bburdette@gmail.com>2020-05-11 14:35:30 -0600
committerBen Burdette <bburdette@gmail.com>2020-05-11 14:35:30 -0600
commit59b1f5c70150a81c7a6fa0dc3309a9d44e9621f8 (patch)
tree542fc01dfaffdf7acbc5c1a89fd41a0918396f4b /src/nix/upgrade-nix.cc
parent536bbf53e12c80f52c2679aec734d895b0058f5b (diff)
parent5bdb67c84308a8cc78ac633d27b94eca87ea4390 (diff)
Merge branch 'master' into errors-phase-2
Diffstat (limited to 'src/nix/upgrade-nix.cc')
-rw-r--r--src/nix/upgrade-nix.cc34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/nix/upgrade-nix.cc b/src/nix/upgrade-nix.cc
index 831a83fd1..9e7ebcd9c 100644
--- a/src/nix/upgrade-nix.cc
+++ b/src/nix/upgrade-nix.cc
@@ -1,7 +1,7 @@
#include "command.hh"
#include "common-args.hh"
#include "store-api.hh"
-#include "download.hh"
+#include "filetransfer.hh"
#include "eval.hh"
#include "attr-path.hh"
#include "names.hh"
@@ -16,18 +16,20 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand
CmdUpgradeNix()
{
- mkFlag()
- .longName("profile")
- .shortName('p')
- .labels({"profile-dir"})
- .description("the Nix profile to upgrade")
- .dest(&profileDir);
-
- mkFlag()
- .longName("nix-store-paths-url")
- .labels({"url"})
- .description("URL of the file that contains the store paths of the latest Nix release")
- .dest(&storePathsUrl);
+ addFlag({
+ .longName = "profile",
+ .shortName = 'p',
+ .description = "the Nix profile to upgrade",
+ .labels = {"profile-dir"},
+ .handler = {&profileDir}
+ });
+
+ addFlag({
+ .longName = "nix-store-paths-url",
+ .description = "URL of the file that contains the store paths of the latest Nix release",
+ .labels = {"url"},
+ .handler = {&storePathsUrl}
+ });
}
std::string description() override
@@ -49,6 +51,8 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand
};
}
+ Category category() override { return catNixInstallation; }
+
void run(ref<Store> store) override
{
evalSettings.pureEval = true;
@@ -142,8 +146,8 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand
Activity act(*logger, lvlInfo, actUnknown, "querying latest Nix version");
// FIXME: use nixos.org?
- auto req = DownloadRequest(storePathsUrl);
- auto res = getDownloader()->download(req);
+ auto req = FileTransferRequest(storePathsUrl);
+ auto res = getFileTransfer()->download(req);
auto state = std::make_unique<EvalState>(Strings(), store);
auto v = state->allocValue();