1# This expression will, as efficiently as possible, dump a
2# *superset* of all attrpaths of derivations which might be
3# part of a release on *any* platform.
4#
5# This expression runs single-threaded under all current Nix
6# implementations, but much faster and with much less memory
7# used than ./outpaths.nix itself.
8#
9# Once you have the list of attrnames you can split it up into
10# $NUM_CORES batches and evaluate the outpaths separately for each
11# batch, in parallel.
12#
13# To dump the attrnames:
14#
15# nix-instantiate --eval --strict --json ci/eval/attrpaths.nix -A names
16#
17{
18 lib ? import (path + "/lib"),
19 trace ? false,
20 path ? ./../..,
21}:
22let
23
24 # TODO: Use mapAttrsToListRecursiveCond when this PR lands:
25 # https://github.com/NixOS/nixpkgs/pull/395160
26 justAttrNames =
27 path: value:
28 let
29 result =
30 if path == [ "AAAAAASomeThingsFailToEvaluate" ] || !(lib.isAttrs value) then
31 [ ]
32 else if lib.isDerivation value then
33 [ path ]
34 else
35 lib.pipe value [
36 (lib.mapAttrsToList (
37 name: value:
38 lib.addErrorContext "while evaluating package set attribute path '${
39 lib.showAttrPath (path ++ [ name ])
40 }'" (justAttrNames (path ++ [ name ]) value)
41 ))
42 lib.concatLists
43 ];
44 in
45 lib.traceIf trace "** ${lib.showAttrPath path}" result;
46
47 outpaths = import ./outpaths.nix {
48 inherit path;
49 attrNamesOnly = true;
50 };
51
52 paths = [
53 # Some of the following are based on variants, which are disabled with `attrNamesOnly = true`.
54 # Until these have been removed from release.nix / hydra, we manually add them to the list.
55 [
56 "pkgsLLVM"
57 "stdenv"
58 ]
59 [
60 "pkgsArocc"
61 "stdenv"
62 ]
63 [
64 "pkgsZig"
65 "stdenv"
66 ]
67 [
68 "pkgsStatic"
69 "stdenv"
70 ]
71 [
72 "pkgsMusl"
73 "stdenv"
74 ]
75 ]
76 ++ justAttrNames [ ] outpaths;
77
78 names = map lib.showAttrPath paths;
79
80in
81{
82 inherit paths names;
83}