Skip to content

Commit

Permalink
nix-env to nix profile: maintain priorities
Browse files Browse the repository at this point in the history
  • Loading branch information
elikoga committed Sep 9, 2023
1 parent 2cdc9c3 commit 98ff8f0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/nix/profile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <nlohmann/json.hpp>
#include <regex>
#include <iomanip>
#include <charconv>

using namespace nix;

Expand Down Expand Up @@ -163,6 +164,16 @@ struct ProfileManifest
for (auto & drvInfo : drvInfos) {
ProfileElement element;
element.storePaths = {drvInfo.queryOutPath()};
Value * priorityV = drvInfo.queryMeta("priority");
if (priorityV && priorityV->type() == nString) {
auto result = std::from_chars(
priorityV->str().data(),
priorityV->str().data() + priorityV->str().size(),
element.priority);
if (result.ec != std::errc()) {
throw Error("profile manifest '%s' has invalid priority '%s'", manifestPath, priorityV->str());
}
}
elements.emplace_back(std::move(element));
}
}
Expand Down

0 comments on commit 98ff8f0

Please sign in to comment.