Skip to content

Commit 7c4bbc5

Browse files
author
kejianchi
committed
feat: modify developing with nix section
1 parent 08ed7f9 commit 7c4bbc5

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

Diff for: src/building/suggested.md

+12-19
Original file line numberDiff line numberDiff line change
@@ -332,29 +332,22 @@ git worktree add -b my-feature ../rust2 master
332332
You can then use that rust2 folder as a separate workspace for modifying and
333333
building `rustc`!
334334

335-
## Using nix-shell
335+
## Working with nix
336336

337-
If you're using nix, you can use the following nix-shell to work on Rust:
337+
Several nix configurations are defined in `src/tools/nix-dev-shell`.
338338

339-
```nix
340-
{ pkgs ? import <nixpkgs> {} }:
341-
pkgs.mkShell {
342-
name = "rustc";
343-
nativeBuildInputs = with pkgs; [
344-
binutils cmake ninja pkg-config python3 git curl cacert patchelf nix
345-
];
346-
buildInputs = with pkgs; [
347-
openssl glibc.out glibc.static
348-
];
349-
# Avoid creating text files for ICEs.
350-
RUSTC_ICE = "0";
351-
# Provide `libstdc++.so.6` for the self-contained lld.
352-
LD_LIBRARY_PATH = "${with pkgs; lib.makeLibraryPath [
353-
stdenv.cc.cc.lib
354-
]}";
355-
}
339+
If you're using direnv, you can create a symbol link to `src/tools/nix-dev-shell/envrc-flake` or `src/tools/nix-dev-shell/envrc-shell`
340+
341+
```bash
342+
ln -s ./src/tools/nix-dev-shell/envrc-flake ./.envrc # Use flake
343+
```
344+
or
345+
```bash
346+
ln -s ./src/tools/nix-dev-shell/envrc-shell ./.envrc # Use nix-shell
356347
```
357348

349+
### Note
350+
358351
Note that when using nix on a not-NixOS distribution, it may be necessary to set
359352
**`patch-binaries-for-nix = true` in `config.toml`**. Bootstrap tries to detect
360353
whether it's running in nix and enable patching automatically, but this

0 commit comments

Comments
 (0)