Skip to content

Instantly share code, notes, and snippets.

@JohnScience
Created August 26, 2023 08:17
Show Gist options
  • Save JohnScience/12a28cb57c0c6e791ba3741dceeef584 to your computer and use it in GitHub Desktop.
Save JohnScience/12a28cb57c0c6e791ba3741dceeef584 to your computer and use it in GitHub Desktop.
My setup for Rust development (Chrome OS)
sudo apt update
# install essential build tools, notably cc linker
sudo apt install build-essential -y
# install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# configure the current shell, suggested by the installation script
source "$HOME/.cargo/env"
# install dependencies
sudo apt install software-properties-common apt-transport-https wget -y
# Import the GPG key provided by Microsoft to verify the package integrity.
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add
# Run the following command to add the Visual Studio Code repository to your system
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
# without this you can get "E: Unable to locate package code"
sudo apt update
# install vscode
sudo apt install code
# verify installation of vscode
code --version
# verify installation of rust
rustc --version
# BEGIN: install various vscode extensions....
code --install-extension rust-lang.rust-analyzer
code --install-extension serayuzgur.crates
code --install-extension vadimcn.vscode-lldb
code --install-extension Gruntfuggly.todo-tree
code --install-extension eamodio.gitlens
code --install-extension hediet.vscode-drawio
code --install-extension donjayamanne.githistory
code --install-extension tamasfe.even-better-toml
code --install-extension GitHub.vscode-github-actions
code --install-extension GitHub.copilot
# END: vscode extensions installed
# install cargo binstall
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
# install sccache
cargo binstall sccache
# configure sccache as a rustc wrapper and use cc linker to avoid problems
# https://github.com/rust-lang/cargo/issues/6582
echo -e [build]\\nrustc-wrapper = \"$(which sccache)\"\\n\\n[target.x86_64-unknown-linux-gnu]\\nlinker = \"/usr/bin/cc\" > $HOME/.cargo/config.toml
# install cargo-make for portable scripts
# binstall isn't used because the pre-built binary relied on C
# https://github.com/rust-lang/cargo/issues/6582
cargo install cargo-make
cargo binstall wasm-pack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment