nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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# Both this expression and what ofborg uses (release-outpaths.nix)
6# are essentially single-threaded (under the current cppnix
7# implementation).
8#
9# This expression runs much, much, much faster and uses much, much
10# less memory than the ofborg script by skipping the
11# platform-relevance checks. The ofborg outpaths.nix script takes
12# half an hour on a 3ghz core and peaks at 60gbytes of memory; this
13# expression runs on the same machine in 44 seconds with peak memory
14# usage of 5gbytes.
15#
16# Once you have the list of attrnames you can split it up into
17# $NUM_CORES batches and run the platform checks separately for each
18# batch, in parallel.
19#
20# To dump the attrnames:
21#
22# nix-instantiate --eval --strict --json pkgs/top-level/release-attrpaths-superset.nix -A names
23#
24{
25 lib ? import (path + "/lib"),
26 trace ? false,
27 checkMeta ? true,
28 path ? ./../..,
29}:
30let
31
32 # The intended semantics are that an attrpath rooted at pkgs is
33 # part of the (unfiltered) release jobset iff both of the following
34 # are true:
35 #
36 # 1. The attrpath leads to a value for which lib.isDerivation is true
37 #
38 # 2. Any proper prefix of the attrpath at which lib.isDerivation
39 # is true also has __recurseIntoDerivationForReleaseJobs=true.
40 #
41 # The second condition is unfortunately necessary because there are
42 # Hydra release jobnames which have proper prefixes which are
43 # attrnames of derivations (!). We should probably restructure
44 # the job tree so that this is not the case.
45 #
46 justAttrNames =
47 path: value:
48 let
49 result =
50 if path == [ "AAAAAASomeThingsFailToEvaluate" ] then
51 [ ]
52 else if
53 lib.isDerivation value
54 &&
55 # in some places we have *derivations* with jobsets as subattributes, ugh
56 !(value.__recurseIntoDerivationForReleaseJobs or false)
57 then
58 [ path ]
59
60 # Even wackier case: we have meta.broken==true jobs with
61 # !meta.broken jobs as subattributes with license=unfree, and
62 # check-meta.nix won't throw an "unfree" failure because the
63 # enclosing derivation is marked broken. Yeah. Bonkers.
64 # We should just forbid jobsets enclosed by derivations.
65 else if lib.isDerivation value && !value.meta.available then
66 [ ]
67
68 else if !(lib.isAttrs value) then
69 [ ]
70 else
71 lib.pipe value [
72 (builtins.mapAttrs (
73 name: value:
74 builtins.addErrorContext "while evaluating package set attribute path '${
75 lib.showAttrPath (path ++ [ name ])
76 }'" (justAttrNames (path ++ [ name ]) value)
77 ))
78 builtins.attrValues
79 builtins.concatLists
80 ];
81 in
82 if !trace then result else lib.trace "** ${lib.concatStringsSep "." path}" result;
83
84 releaseOutpaths = import ./release-outpaths.nix {
85 inherit checkMeta;
86 attrNamesOnly = true;
87 inherit path;
88 };
89
90 paths = [
91 # I am not entirely sure why these three packages end up in
92 # the Hydra jobset. But they do, and they don't meet the
93 # criteria above, so at the moment they are special-cased.
94 [
95 "pkgsLLVM"
96 "stdenv"
97 ]
98 [
99 "pkgsStatic"
100 "stdenv"
101 ]
102 [
103 "pkgsMusl"
104 "stdenv"
105 ]
106 ]
107 ++ justAttrNames [ ] releaseOutpaths;
108
109 names = map (path: (lib.concatStringsSep "." path)) paths;
110
111in
112{
113 inherit paths names;
114}