Skip to content

Feat: cargo available for user#305

Open
SzymonTurno wants to merge 2 commits into
zephyrproject-rtos:mainfrom
SzymonTurno:feat/cargo-available-for-user
Open

Feat: cargo available for user#305
SzymonTurno wants to merge 2 commits into
zephyrproject-rtos:mainfrom
SzymonTurno:feat/cargo-available-for-user

Conversation

@SzymonTurno

@SzymonTurno SzymonTurno commented Jun 18, 2026

Copy link
Copy Markdown

Commit 1/2

Make cargo available for user out-of-the-box by using RUSTUP_HOME and CARGO_HOME the way it is done in rust-lang/docker-rust/refs/heads/master/Dockerfile-slim.template.

Commit 2/2

Add symlinks and persist env vars to support west and cargo builds via sudo su.


closes #306

Install Rust into /usr/local/{rustup,cargo} via ENV so cargo and rustup
are on PATH for all users, not just the build-time root shell. Add
chmod -R a+w on both homes so non-root users can write to the registry
cache and toolchain directories.

Signed-off-by: Szymon Turno <szymon@turno.pl>
Symlink west, cargo, and rustup into /usr/local/bin so they remain
accessible in shells that reset PATH (e.g. sudo su). Persist
RUSTUP_HOME and CARGO_HOME to /etc/environment so rustup can locate
the toolchain after sudo resets the environment.

Signed-off-by: Szymon Turno <szymon@turno.pl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cargo available for user and sudo su

1 participant