forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackages-info.nix
More file actions
57 lines (56 loc) · 1.76 KB
/
Copy pathpackages-info.nix
File metadata and controls
57 lines (56 loc) · 1.76 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
trace ? false,
}:
let
pkgs = import ../.. { config = import ./packages-config.nix; };
inherit (pkgs) lib;
generateInfo =
path: value:
let
result =
if path == [ "AAAAAASomeThingsFailToEvaluate" ] || !(lib.isAttrs value) then
[ ]
else if lib.isDerivation value then
[
{
name = lib.showAttrPath path;
value = {
inherit (value)
meta
name
outputName
system
;
${if value ? "outputs" then "outputs" else null} = lib.listToAttrs (
lib.map (x: {
name = x;
value = null;
}) value.outputs
);
# TODO: Remove the following two fallbacks when all packages have been fixed.
# Note: pname and version are *required* by repology, so do not change to
# the optional pattern from above.
pname = value.pname or value.name;
version = value.version or "";
};
}
]
else if value.recurseForDerivations or false then
lib.pipe value [
(lib.mapAttrsToList (
name: value:
lib.addErrorContext "while evaluating package set attribute path '${
lib.showAttrPath (path ++ [ name ])
}'" (generateInfo (path ++ [ name ]) value)
))
lib.concatLists
]
else
[ ];
in
lib.traceIf trace "** ${lib.showAttrPath path}" (lib.deepSeq result result);
in
lib.strings.toJSON {
version = "2";
packages = lib.listToAttrs (generateInfo [ ] (lib.recurseIntoAttrs pkgs));
}