From 9d65a3cdd8d73fd92418ef317b671bd14d105141 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 23 Dec 2021 00:46:12 +0100 Subject: [PATCH] lib: add maybeHead --- lib/default.nix | 2 ++ 1 file changed, 2 insertions(+) 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;