1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 18:31:49 +02:00

fix: ensure apps are apps and packages are packages

This commit is contained in:
Tom Bereknyei 2022-03-25 13:36:41 -04:00
parent 646af7325d
commit 9b41239d8f
4 changed files with 43 additions and 0 deletions

View file

@ -65,6 +65,15 @@ UnresolvedApp Installable::toApp(EvalState & state)
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);
}
if (type == "app") {
auto [program, context] = cursor->getAttr("program")->getStringWithContext();