Conversation
Fix handling of missing extra-cmake-modules in Nix
There was a problem hiding this comment.
Code Review
This pull request updates the fcitx5-lotus Nix derivation to allow extra-cmake-modules to be provided either as a direct argument or via kdePackages. The reviewer suggested improving the robustness of the attribute check using the ? operator and providing a more descriptive error message in the throw statement to aid in troubleshooting.
| ecm = | ||
| if extra-cmake-modules != null then | ||
| extra-cmake-modules | ||
| else if kdePackages != null then | ||
| kdePackages.extra-cmake-modules | ||
| else | ||
| throw "Cannot find extra-cmake-modules"; |
There was a problem hiding this comment.
The error message in the throw statement could be more descriptive to help identify which package is failing and why. Additionally, using the ? operator to check for the existence of extra-cmake-modules within kdePackages is more robust than just checking if kdePackages is not null, as it handles cases where kdePackages might be an empty set.
ecm =
if extra-cmake-modules != null then
extra-cmake-modules
else if kdePackages ? extra-cmake-modules then
kdePackages.extra-cmake-modules
else
throw "fcitx5-lotus: extra-cmake-modules not found; please provide it directly or via kdePackages.";
No description provided.