Skip to content

nix-shell documentation #115969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,54 @@ See [the rustc-dev-guide for more info][sysllvm].

[sysllvm]: https://rustc-dev-guide.rust-lang.org/building/new-target.html#using-pre-built-llvm

In the case of the Nix Package Manager being used, the following shell can be used to install deependencies for users:

```nix
# Rust User Shell
let
# Unstable Channel | Rolling Release
pkgs = import (fetchTarball("channel:nixpkgs-unstable")) { };

packages = with pkgs; [
pkg-config
rustc
cargo
rustfmt
rust-analyzer
];
in
pkgs.mkShell {
buildInputs = packages;
}
```

In the case of the Nix Package Manager being used, the following shell can be used to install deependencies for contributors:

```nix
# Rust Contributor Shell
let
# Unstable Channel | Rolling Release
pkgs = import (fetchTarball("channel:nixpkgs-unstable")) { };

packages = with pkgs; [
pkg-config
rustc
cargo
rustfmt
rust-analyzer
python3
git
libgcc
gnumake
curl
cmake
libstdcxx5
];
in
pkgs.mkShell {
buildInputs = packages;
}
```
### Building on a Unix-like system

#### Build steps
Expand Down
23 changes: 23 additions & 0 deletions nix-shell/rust_contributor_shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Rust Contributor Shell
let
# Unstable Channel | Rolling Release
pkgs = import (fetchTarball("channel:nixpkgs-unstable")) { };

packages = with pkgs; [
pkg-config
rustc
cargo
rustfmt
rust-analyzer
python3
git
libgcc
gnumake
curl
cmake
libstdcxx5
];
in
pkgs.mkShell {
buildInputs = packages;
}
16 changes: 16 additions & 0 deletions nix-shell/rust_user_shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Rust User Shell
let
# Unstable Channel | Rolling Release
pkgs = import (fetchTarball("channel:nixpkgs-unstable")) { };

packages = with pkgs; [
pkg-config
rustc
cargo
rustfmt
rust-analyzer
];
in
pkgs.mkShell {
buildInputs = packages;
}