summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2021-12-23 00:46:12 +0100
committertv <tv@krebsco.de>2021-12-23 00:46:12 +0100
commit9d65a3cdd8d73fd92418ef317b671bd14d105141 (patch)
tree7bffdc2a6747a32ab7b36466ca53010b98565f27 /lib
parent448cd3b9af9e39980676f8ade7e5fb80dbb58b9f (diff)
lib: add maybeHead
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 738e52186..574713e48 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -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;