-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.nix
34 lines (31 loc) · 1.24 KB
/
main.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{ pkgs }:
let
unknown = x: set:
if (builtins.isAttrs set) && (builtins.hasAttr x set) && (builtins.isString (builtins.getAttr x set)) then
builtins.toString (builtins.getAttr x set)
else
"unknown";
getDescription = pkg:
if (builtins.hasAttr "meta" pkg) && (builtins.hasAttr "description" pkg.meta) then
pkg.meta.description
else
"";
getLongDescription = pkg:
if (builtins.hasAttr "meta" pkg) && (builtins.hasAttr "longDescription" pkg.meta) then
pkg.meta.longDescription
else
"";
# isBroken = pkg: (builtins.isAttrs pkg) && (((builtins.hasAttr "broken" pkg) && (pkg.broken)) || ((builtins.hasAttr "meta" pkg) && (builtins.hasAttr "broken" pkg.meta) && pkg.meta.broken));
in builtins.toJSON (builtins.mapAttrs (name: pkg:
let r = builtins.tryEval pkg;
in if r.success && (builtins.isAttrs pkg) then
if (builtins.hasAttr "version" pkg) && (builtins.isString pkg.version) then
{
inherit name;
version = pkg.version;
description = getDescription pkg;
longDescription = getLongDescription pkg;
} else
{ name = "${name}-plop"; version = "plop"; description = "plop"; longDescription = "plop";}
else
{ }) (pkgs))# // pkgs.python3Packages // pkgs.rPackages // { }))