Last active
March 29, 2020 16:59
-
-
Save unpluggedcoder/8c3ef7a45bec967e83706956b0055b85 to your computer and use it in GitHub Desktop.
Rust development setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
################## | |
# For Chinese ONLY | |
tee -a ~/.zshrc <<'EOF' | |
export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup | |
export RUSTUP_DIST_SERVER=https://mirrors.tuna.tsinghua.edu.cn/rustup | |
EOF | |
################## | |
# install rustup | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | |
################## | |
# For Chinese ONLY | |
tee -a ~/.zshrc <<'EOF' | |
export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src" | |
EOF | |
tee ~/.cargo.config <<'EOF' | |
[source.crates-io] | |
registry = "https://github.com/rust-lang/crates.io-index" | |
replace-with = 'ustc' | |
[source.ustc] | |
registry = "git://mirrors.ustc.edu.cn/crates.io-index" | |
EOF | |
################## | |
# cargo cache | |
# usage: $ cargo cache --autoclean | |
cargo install cargo-cache | |
# For vim | |
# Racer - https://github.com/racer-rust/vim-racer | |
rustup toolchain add nightly | |
cargo +nightly install racer | |
# Diesel | |
# For all backend | |
# cargo install diesel_cli | |
# Or Postgresql only | |
cargo install diesel_cli --no-default-features --features postgres |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment