1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 13:41:15 +02:00

Fix compilation, style fixes

This commit is contained in:
Eelco Dolstra 2022-04-19 12:09:12 +02:00
parent b529a41814
commit 2016b7142a
2 changed files with 13 additions and 18 deletions

View file

@ -62,22 +62,17 @@ std::string resolveString(Store & store, const std::string & toResolve, const Bu
UnresolvedApp Installable::toApp(EvalState & state)
{
auto cursor = getCursor(state);
auto attrPath = cursor->getAttrPath();
auto type = cursor->getAttr("type")->getString();
std::string expected;
if (hasPrefix(attrPath,"apps.")) {
expected = "app";
} else {
expected = "derivation";
}
if (type != expected) {
throw Error("Attribute '%s' should have type '%s'.", attrPath, expected);
}
std::string expected = !attrPath.empty() && attrPath[0] == "apps" ? "app" : "derivation";
if (type != expected)
throw Error("attribute '%s' should have type '%s'", cursor->getAttrPathStr(), expected);
if (type == "app") {
auto [program, context] = cursor->getAttr("program")->getStringWithContext();
std::vector<StorePathWithOutputs> context2;
for (auto & [path, name] : context)
context2.push_back({path, {name}});