aboutsummaryrefslogtreecommitdiff
path: root/src/nix/profile.cc
diff options
context:
space:
mode:
authorEli Kogan-Wang <elikowa@gmail.com>2022-05-13 22:02:28 +0200
committerEli Kogan-Wang <elikowa@gmail.com>2022-05-13 22:02:28 +0200
commitbe2b19041eeec53fba24f7c2494f3f700a4ec595 (patch)
tree81aae651f6e300c5deb97feb68c8d1695b3fef3d /src/nix/profile.cc
parentaefc6c4f41bfac0c76807c234fd0a786dd40f140 (diff)
Integrate review changes
Diffstat (limited to 'src/nix/profile.cc')
-rw-r--r--src/nix/profile.cc25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/nix/profile.cc b/src/nix/profile.cc
index fb8bef670..ca5041873 100644
--- a/src/nix/profile.cc
+++ b/src/nix/profile.cc
@@ -269,14 +269,7 @@ struct CmdProfileInstall : InstallablesCommand, MixDefaultProfile
.longName = "priority",
.description = "The priority of the package to install.",
.labels = {"priority"},
- .handler = {[&](std::string s) {
- try{
- priority = std::stoi(s);
- } catch (std::invalid_argument & e) {
- throw ParseError("invalid priority '%s'", s);
- }
- }},
- // .completer = // no completer since number
+ .handler = {&priority},
});
};
@@ -303,21 +296,27 @@ struct CmdProfileInstall : InstallablesCommand, MixDefaultProfile
for (auto & installable : installables) {
ProfileElement element;
- if(priority) {
- element.priority = *priority;
- };
+
if (auto installable2 = std::dynamic_pointer_cast<InstallableFlake>(installable)) {
// FIXME: make build() return this?
- auto [attrPath, resolvedRef, drv] = installable2->toDerivation();
+ auto [attrPath, resolvedRef, drv, priority] = installable2->toDerivation();
element.source = ProfileElementSource {
installable2->flakeRef,
resolvedRef,
attrPath,
installable2->outputsSpec
};
+
+ if(drv.priority) {
+ element.priority = *drv.priority;
+ }
}
+ if(priority) { // if --priority was specified we want to override the priority of the installable
+ element.priority = *priority;
+ };
+
element.updateStorePaths(getEvalStore(), store, builtPaths[installable.get()]);
manifest.elements.push_back(std::move(element));
@@ -476,7 +475,7 @@ struct CmdProfileUpgrade : virtual SourceExprCommand, MixDefaultProfile, MixProf
Strings{},
lockFlags);
- auto [attrPath, resolvedRef, drv] = installable->toDerivation();
+ auto [attrPath, resolvedRef, drv, priority] = installable->toDerivation();
if (element.source->resolvedRef == resolvedRef) continue;