lib: add maybeHead

This commit is contained in:
tv 2021-12-23 00:46:12 +01:00
parent 448cd3b9af
commit 9d65a3cdd8

View File

@ -39,6 +39,8 @@ let
listToAttrs (map (name: nameValuePair name set.${name})
(filter (flip hasAttr set) names));
maybeHead = x: if isList x && length x > 0 then head x else null;
packageName = pkg:
pkg.pname or (parseDrvName pkg.name).name;