diff options
| author | chiichen <chiichen@qq.com> | 2025-01-30 17:56:31 +0800 |
|---|---|---|
| committer | chiichen <chiichen@qq.com> | 2025-01-30 18:03:27 +0800 |
| commit | fd911ea65a50c838f4334ef353c80ec46358c9e6 (patch) | |
| tree | e2ea9b0e3b607e9d2a7f74ffee43d6786f146ebb | |
| parent | 00cb12a5210c631213889f5196de572db05bf3f7 (diff) | |
| download | rust-fd911ea65a50c838f4334ef353c80ec46358c9e6.tar.gz rust-fd911ea65a50c838f4334ef353c80ec46358c9e6.zip | |
feat: modify developing with nix section
| -rw-r--r-- | src/doc/rustc-dev-guide/src/building/suggested.md | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/src/doc/rustc-dev-guide/src/building/suggested.md b/src/doc/rustc-dev-guide/src/building/suggested.md index f498875ce1b..2c6c3fe1df8 100644 --- a/src/doc/rustc-dev-guide/src/building/suggested.md +++ b/src/doc/rustc-dev-guide/src/building/suggested.md @@ -332,29 +332,22 @@ git worktree add -b my-feature ../rust2 master You can then use that rust2 folder as a separate workspace for modifying and building `rustc`! -## Using nix-shell +## Working with nix -If you're using nix, you can use the following nix-shell to work on Rust: +Several nix configurations are defined in `src/tools/nix-dev-shell`. -```nix -{ pkgs ? import <nixpkgs> {} }: -pkgs.mkShell { - name = "rustc"; - nativeBuildInputs = with pkgs; [ - binutils cmake ninja pkg-config python3 git curl cacert patchelf nix - ]; - buildInputs = with pkgs; [ - openssl glibc.out glibc.static - ]; - # Avoid creating text files for ICEs. - RUSTC_ICE = "0"; - # Provide `libstdc++.so.6` for the self-contained lld. - LD_LIBRARY_PATH = "${with pkgs; lib.makeLibraryPath [ - stdenv.cc.cc.lib - ]}"; -} +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` + +```bash +ln -s ./src/tools/nix-dev-shell/envrc-flake ./.envrc # Use flake +``` +or +```bash +ln -s ./src/tools/nix-dev-shell/envrc-shell ./.envrc # Use nix-shell ``` +### Note + Note that when using nix on a not-NixOS distribution, it may be necessary to set **`patch-binaries-for-nix = true` in `config.toml`**. Bootstrap tries to detect whether it's running in nix and enable patching automatically, but this |
