diff options
author | tv <tv@krebsco.de> | 2021-12-23 00:46:12 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2021-12-23 00:46:12 +0100 |
commit | 9d65a3cdd8d73fd92418ef317b671bd14d105141 (patch) | |
tree | 7bffdc2a6747a32ab7b36466ca53010b98565f27 | |
parent | 448cd3b9af9e39980676f8ade7e5fb80dbb58b9f (diff) |
lib: add maybeHead
-rw-r--r-- | lib/default.nix | 2 |
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; |