1{
2 lib,
3 config,
4 buildPlatform,
5 hostPlatform,
6 fetchurl,
7 checkMeta,
8}:
9
10lib.makeScope
11 # Prevent using top-level attrs to protect against introducing dependency on
12 # non-bootstrap packages by mistake. Any top-level inputs must be explicitly
13 # declared here.
14 (
15 extra:
16 lib.callPackageWith (
17 {
18 inherit
19 lib
20 config
21 buildPlatform
22 hostPlatform
23 fetchurl
24 checkMeta
25 ;
26 }
27 // extra
28 )
29 )
30 (
31 self: with self; {
32
33 bash_2_05 = callPackage ./bash/2.nix { tinycc = tinycc-mes; };
34
35 bash = callPackage ./bash {
36 bootBash = bash_2_05;
37 tinycc = tinycc-musl;
38 coreutils = coreutils-musl;
39 gnumake = gnumake-musl;
40 gnutar = gnutar-musl;
41 };
42
43 binutils = callPackage ./binutils {
44 tinycc = tinycc-musl;
45 gnumake = gnumake-musl;
46 gnutar = gnutar-musl;
47 };
48
49 bzip2 = callPackage ./bzip2 {
50 tinycc = tinycc-musl;
51 gnumake = gnumake-musl;
52 gnutar = gnutar-musl;
53 };
54
55 coreutils = callPackage ./coreutils { tinycc = tinycc-mes; };
56 coreutils-musl = callPackage ./coreutils/musl.nix {
57 bash = bash_2_05;
58 tinycc = tinycc-musl;
59 gnumake = gnumake-musl;
60 gnutar = gnutar-musl;
61 };
62
63 diffutils = callPackage ./diffutils {
64 bash = bash_2_05;
65 tinycc = tinycc-musl;
66 gnumake = gnumake-musl;
67 gnutar = gnutar-musl;
68 };
69
70 findutils = callPackage ./findutils {
71 tinycc = tinycc-musl;
72 gnumake = gnumake-musl;
73 gnutar = gnutar-musl;
74 };
75
76 gawk-mes = callPackage ./gawk/mes.nix {
77 bash = bash_2_05;
78 tinycc = tinycc-mes;
79 gnused = gnused-mes;
80 };
81
82 gawk = callPackage ./gawk {
83 bash = bash_2_05;
84 tinycc = tinycc-musl;
85 gnumake = gnumake-musl;
86 gnutar = gnutar-musl;
87 bootGawk = gawk-mes;
88 };
89
90 gcc46 = callPackage ./gcc/4.6.nix {
91 tinycc = tinycc-musl;
92 gnumake = gnumake-musl;
93 gnutar = gnutar-musl;
94 # FIXME: not sure why new gawk doesn't work
95 gawk = gawk-mes;
96 };
97 gcc46-cxx = callPackage ./gcc/4.6.cxx.nix {
98 gcc = gcc46;
99 gnumake = gnumake-musl;
100 gnutar = gnutar-musl;
101 # FIXME: not sure why new gawk doesn't work
102 gawk = gawk-mes;
103 };
104
105 gcc8 = callPackage ./gcc/8.nix {
106 gcc = gcc46-cxx;
107 gnumake = gnumake-musl;
108 gnutar = gnutar-latest;
109 # FIXME: not sure why new gawk doesn't work
110 gawk = gawk-mes;
111 };
112
113 gcc-latest = callPackage ./gcc/latest.nix {
114 gcc = gcc8;
115 gnumake = gnumake-musl;
116 gnutar = gnutar-latest;
117 # FIXME: not sure why new gawk doesn't work
118 gawk = gawk-mes;
119 };
120
121 gnugrep = callPackage ./gnugrep {
122 bash = bash_2_05;
123 tinycc = tinycc-mes;
124 };
125
126 gnumake = callPackage ./gnumake { tinycc = tinycc-mes; };
127
128 gnumake-musl = callPackage ./gnumake/musl.nix {
129 bash = bash_2_05;
130 tinycc = tinycc-musl;
131 gawk = gawk-mes;
132 gnumakeBoot = gnumake;
133 };
134
135 gnupatch = callPackage ./gnupatch { tinycc = tinycc-mes; };
136
137 gnused = callPackage ./gnused {
138 bash = bash_2_05;
139 tinycc = tinycc-musl;
140 gnused = gnused-mes;
141 };
142 gnused-mes = callPackage ./gnused/mes.nix {
143 bash = bash_2_05;
144 tinycc = tinycc-mes;
145 };
146
147 gnutar = callPackage ./gnutar/mes.nix {
148 bash = bash_2_05;
149 tinycc = tinycc-mes;
150 gnused = gnused-mes;
151 };
152
153 gnutar-musl = callPackage ./gnutar/musl.nix {
154 bash = bash_2_05;
155 tinycc = tinycc-musl;
156 gnused = gnused-mes;
157 };
158
159 # FIXME: better package naming scheme
160 gnutar-latest = callPackage ./gnutar/latest.nix {
161 gcc = gcc46;
162 gnumake = gnumake-musl;
163 gnutarBoot = gnutar-musl;
164 };
165
166 gzip = callPackage ./gzip {
167 bash = bash_2_05;
168 tinycc = tinycc-mes;
169 gnused = gnused-mes;
170 };
171
172 heirloom = callPackage ./heirloom {
173 bash = bash_2_05;
174 tinycc = tinycc-mes;
175 };
176
177 heirloom-devtools = callPackage ./heirloom-devtools { tinycc = tinycc-mes; };
178
179 linux-headers = callPackage ./linux-headers { bash = bash_2_05; };
180
181 ln-boot = callPackage ./ln-boot { };
182
183 mes = callPackage ./mes { };
184 mes-libc = callPackage ./mes/libc.nix { };
185
186 musl11 = callPackage ./musl/1.1.nix {
187 bash = bash_2_05;
188 tinycc = tinycc-mes;
189 gnused = gnused-mes;
190 };
191
192 musl = callPackage ./musl {
193 gcc = gcc46;
194 gnumake = gnumake-musl;
195 };
196
197 stage0-posix = callPackage ./stage0-posix { };
198
199 inherit (self.stage0-posix)
200 kaem
201 m2libc
202 mescc-tools
203 mescc-tools-extra
204 ;
205
206 tinycc-bootstrappable = lib.recurseIntoAttrs (callPackage ./tinycc/bootstrappable.nix { });
207 tinycc-mes = lib.recurseIntoAttrs (callPackage ./tinycc/mes.nix { });
208 tinycc-musl = lib.recurseIntoAttrs (
209 callPackage ./tinycc/musl.nix {
210 bash = bash_2_05;
211 musl = musl11;
212 }
213 );
214
215 xz = callPackage ./xz {
216 bash = bash_2_05;
217 tinycc = tinycc-musl;
218 gnumake = gnumake-musl;
219 gnutar = gnutar-musl;
220 };
221
222 inherit (callPackage ./utils.nix { }) derivationWithMeta writeTextFile writeText;
223
224 test = kaem.runCommand "minimal-bootstrap-test" { } ''
225 echo ${bash.tests.get-version}
226 echo ${bash_2_05.tests.get-version}
227 echo ${binutils.tests.get-version}
228 echo ${bzip2.tests.get-version}
229 echo ${coreutils-musl.tests.get-version}
230 echo ${diffutils.tests.get-version}
231 echo ${findutils.tests.get-version}
232 echo ${gawk-mes.tests.get-version}
233 echo ${gawk.tests.get-version}
234 echo ${gcc46.tests.get-version}
235 echo ${gcc46-cxx.tests.hello-world}
236 echo ${gcc8.tests.hello-world}
237 echo ${gcc-latest.tests.hello-world}
238 echo ${gnugrep.tests.get-version}
239 echo ${gnused.tests.get-version}
240 echo ${gnused-mes.tests.get-version}
241 echo ${gnutar.tests.get-version}
242 echo ${gnutar-musl.tests.get-version}
243 echo ${gnutar-latest.tests.get-version}
244 echo ${gzip.tests.get-version}
245 echo ${heirloom.tests.get-version}
246 echo ${mes.compiler.tests.get-version}
247 echo ${musl.tests.hello-world}
248 echo ${tinycc-mes.compiler.tests.chain}
249 echo ${tinycc-musl.compiler.tests.hello-world}
250 echo ${xz.tests.get-version}
251 mkdir ''${out}
252 '';
253 }
254 )