Skip to content

Instantly share code, notes, and snippets.

@unpluggedcoder
Last active March 29, 2020 16:59
Show Gist options
  • Save unpluggedcoder/8c3ef7a45bec967e83706956b0055b85 to your computer and use it in GitHub Desktop.
Save unpluggedcoder/8c3ef7a45bec967e83706956b0055b85 to your computer and use it in GitHub Desktop.
Rust development setup
#!/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