1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 10:11:47 +02:00

nix-env to nix profile: maintain priorities

This commit is contained in:
Eli Kogan-Wang 2023-09-09 13:49:25 +02:00
parent fbe2940a08
commit 46c665e34e

View file

@ -16,6 +16,7 @@
#include <nlohmann/json.hpp>
#include <regex>
#include <iomanip>
#include <charconv>
#include "strings.hh"
@ -186,6 +187,16 @@ struct ProfileManifest
for (auto & packageInfo : packageInfos) {
ProfileElement element;
element.storePaths = {packageInfo.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());
}
}
addElement(std::move(element));
}
}