@@ -276,67 +276,34 @@ If you're using nix, you can use the following nix-shell to work on Rust:
276
276
277
277
``` nix
278
278
{ pkgs ? import <nixpkgs> {} }:
279
-
280
- # This file contains a development shell for working on rustc.
281
- let
282
- # Build configuration for rust-lang/rust. Based on `config.example.toml` (then called
283
- # `config.toml.example`) from `1bd30ce2aac40c7698aa4a1b9520aa649ff2d1c5`
284
- config = pkgs.writeText "rustc-config" ''
285
- profile = "compiler" # you may want to choose a different profile, like `library` or `tools`
286
-
287
- [build]
288
- patch-binaries-for-nix = true
289
- # The path to (or name of) the GDB executable to use. This is only used for
290
- # executing the debuginfo test suite.
291
- gdb = "${pkgs.gdb}/bin/gdb"
292
- python = "${pkgs.python3Full}/bin/python"
293
-
294
- [rust]
295
- debug = true
296
- incremental = true
297
- deny-warnings = false
298
-
299
- # Indicates whether some LLVM tools, like llvm-objdump, will be made available in the
300
- # sysroot.
301
- llvm-tools = true
302
-
303
- # Print backtrace on internal compiler errors during bootstrap
304
- backtrace-on-ice = true
305
- '';
306
-
307
- ripgrepConfig =
308
- let
309
- # Files that are ignored by ripgrep when searching.
310
- ignoreFile = pkgs.writeText "rustc-rgignore" ''
311
- configure
312
- config.example.toml
313
- x.py
314
- LICENSE-MIT
315
- LICENSE-APACHE
316
- COPYRIGHT
317
- **/*.txt
318
- **/*.toml
319
- **/*.yml
320
- **/*.nix
321
- *.md
322
- src/ci
323
- src/etc/
324
- src/llvm-emscripten/
325
- src/llvm-project/
326
- src/rtstartup/
327
- src/rustllvm/
328
- src/stdsimd/
329
- src/tools/rls/rls-analysis/test_data/
330
- '';
331
- in
332
- pkgs.writeText "rustc-ripgreprc" "--ignore-file=${ignoreFile}";
333
- in
334
279
pkgs.mkShell {
335
280
name = "rustc";
336
281
nativeBuildInputs = with pkgs; [
337
- gcc_multi binutils cmake ninja openssl pkgconfig python39 git curl cacert patchelf nix psutils
282
+ binutils cmake ninja pkg-config python3 git curl cacert patchelf nix
283
+ ];
284
+ buildInputs = with pkgs; [
285
+ openssl glibc.out glibc.static
338
286
];
339
- RIPGREP_CONFIG_PATH = ripgrepConfig;
287
+ # Avoid creating text files for ICEs.
288
+ RUSTC_ICE = "0";
289
+ }
290
+ ```
291
+
292
+ Note that when using nix on a not-NixOS distribution, it may be necessary to set
293
+ ** ` patch-binaries-for-nix = true ` in ` config.toml ` ** .
294
+ Bootstrap tries to detect whether it's running in nix and enable patching automatically,
295
+ but this detection can have false negatives.
296
+
297
+ You can also use your nix shell to manage ` config.toml ` :
298
+
299
+ ``` nix
300
+ let
301
+ config = pkgs.writeText "rustc-config" ''
302
+ # Your config.toml content goes here
303
+ ''
304
+ pkgs.mkShell {
305
+ /* ... */
306
+ # This environment varaible tells bootstrap where our config.toml is.
340
307
RUST_BOOTSTRAP_CONFIG = config;
341
308
}
342
309
```
0 commit comments