This is a general guide not ony for atomic desktops.
For various reasons you might want to install rust packages (called “crates”) with the rust package manager cargo
.
These not only include libraries or development requirements, but also packages you might want, while avoiding layering them.
1. Install rust locally
This is the officially recommended way.
Go to your home directory
cd
(To avoid outdated information I will not quote it here)
This should also install cargo.
2. Add cargo to your path
The rustup
installer should set things up or tell you what you need to do.
Make sure this is in your path: $HOME/.cargo/bin
On bash or zsh:
echo "PATH=$PATH:$HOME/.cargo/bin" >> ~/.bashrc
On fish:
mkdir -p ~/.config/fish/conf.d
echo "set PATH PATH:$HOME/.cargo/bin" >> ~/.config/fish/conf.d/rustup.fish
Exit the shell (close the terminal or terminal tab) and reopen it, it should be applied.
3. Set up cargo
This is required. Again, stay in your home directory
cargo init
Now you can install whatever you want using cargo install x
, example:
cargo install sddm2rpm
For a workaround to create RPMs you can layer for SDDM themes (on Kinoite or other variants using the SDDM login manager)
Exceptions
Sometimes you may not be able to use install
, as a package may be listed as a library.
So make sure you are in your home directory and use cargo add x
instead.
cargo binstall
cargo
compiles the packages and all requirements on installation locally, which is a security and performance measurement.
But if you want to skip this and instead use available binaries, you need the binstall
addition.
Upstream install instructions:
cargo install cargo-binstall
Alternatively, you can use these instructions for the linux install script, but there should be no need, if you alreay have a recent rust and cargo installed. You might be able to skip these steps though.
Now you can install binaries without compiling, from their binary package repo.
cargo binstall x
Stay updated
To update the rust installer rustup
, the rust language and compiler, and the package manager cargo
:
rustup update
To upgrade all installed rust crates with cargo:
cargo install cargo-update
cargo install-update -a
Check versions
cargo --version
rustc --version
rustup --version