diff options
author | Tom Bereknyei <tomberek@gmail.com> | 2022-03-25 13:36:41 -0400 |
---|---|---|
committer | Tom Bereknyei <tomberek@gmail.com> | 2022-04-14 23:57:52 -0400 |
commit | 9b41239d8fdcc3fe50febe718c15833ebc224354 (patch) | |
tree | 26faaae8e82c91d8790cd9e997863a349cf59c4c /src/nix/app.cc | |
parent | 646af7325d93f98802b989f8a8e008a25f7a4788 (diff) |
fix: ensure apps are apps and packages are packages
Diffstat (limited to 'src/nix/app.cc')
-rw-r--r-- | src/nix/app.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nix/app.cc b/src/nix/app.cc index 803d028f0..a43566496 100644 --- a/src/nix/app.cc +++ b/src/nix/app.cc @@ -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(); |