summaryrefslogtreecommitdiffstats
path: root/pkgs/development/rocm-modules/release-attrPaths-gen.nix
blob: 074cf2fe4c9db886b12b5eaec6703b4347554ed9 (plain)
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
{
  variant,
}:
let
  pkgs = import ../../../. { config.allowAliases = false; };
  lib = pkgs.lib;
  optionalsWithSuccess =
    toTry: next:
    let
      tried = builtins.tryEval toTry;
    in
    lib.optionals tried.success (next tried.value);
  findAll =
    path: obj:
    optionalsWithSuccess obj (
      obj:
      if obj ? outPath then
        optionalsWithSuccess obj.outPath or null (
          outPath:
          # filter out unavailable, broken packages, and drvs with broken deps
          lib.optional (!((obj ? meta) && (!obj.meta.available or false || obj.meta.broken))) {
            p = path;
            o = outPath;
          }
        )
      else if (obj.recurseForDerivations or false) || (obj.recurseForRelease or false) then
        lib.concatLists (
          lib.mapAttrsToList (
            name: value: findAll (if path == null then name else path + "." + name) value
          ) obj
        )
      else
        [ ]
    );
in
findAll null (pkgs.${variant} // { recurseForDerivations = true; })