Skip to content

Rustup installer prompt or cli argument to install rust on drive in which the user wants instead of C: in windows #3495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
w1redch4d opened this issue Sep 30, 2023 · 7 comments

Comments

@w1redch4d
Copy link

w1redch4d commented Sep 30, 2023

Problem you are trying to solve

for now there seems to be no way to tell rustup-init to install rust and cargo on any other drive than the default C: drive on WIndows , An option to change the rust installation drive with rustup would be a good enhancement imo

Solution you'd like

A prompt in rustup-init after going for customize installation to enter the preferred path in which rust should be installed or a cli argument for the same purpose should do

Notes

I am willing to contribute on this issue

@rami3l
Copy link
Member

rami3l commented Oct 1, 2023

@w1redch4d Hi! Currently the installation path selection is implemented via environment variables.

Have you tried setting CARGO_HOME and/or RUSTUP_HOME to somewhere else?

@w1redch4d
Copy link
Author

w1redch4d commented Oct 1, 2023

Yep, ik that as mentioned in #618 , but ig an installation path prompt in rustup-init might be more helpful for people who are just getting started ?

@rami3l
Copy link
Member

rami3l commented Oct 1, 2023

@w1redch4d Thanks for your willingness to contribute on this issue! However, there is indeed a reason why options/prompts haven't been provided for this one:

Hm, changing the installation dir in the installer comes with some complexity because after installation the environment should be configured with custom values for CARGO_HOME and RUSTUP_HOME or else it won't work right. Think we should hold off on that.

Originally posted by @brson in #618 (comment)


I see what you mean, but IIUC it is still the case that CARGO_HOME is used not only by rustup, but also by cargo and others. Thus, passing an option to rustup indicating what CARGO_HOME should be is not very effective: this must be done before even launching rustup-init and it must somehow persist, otherwise certain things might go wrong.

Maybe the best thing that we can do currently (without breaking our compatibility promises) could be something like the following:

The Rust toolchain will be installed in {RUSTUP_HOME} and cargo will use {CARGO_HOME}.
Are these directories ok?

[Input:] Y/n

(on n): To install the Rust toolchain in a different directory, set the RUSTUP_HOME and/or CARGO_HOME environment variables to appropriate values before running the installer. (program exit).

Originally posted by @gnzlbg in #618 (comment)


As a point of improvement, in a subsequent PR, you can make rustup-init offer to make this change for you (which you can refuse, or course) via something like [Environment]::SetEnvironmentVariable('Foo', 'Bar', 'Machine') on Windows or by appending to the current .profile on Unix, after which it might say restart `rustup-init` to proceed with the installation and exits.

I'm not sure if this will break anything though... cc @rbtcollins

@djc
Copy link
Contributor

djc commented Oct 2, 2023

I don't think we should offer functionality within rustup to manipulate the environment like that, that feels like opening a can of worms in complexity at a time when we're already quite limited in development capacity. But adding better inline guidance and documentation sounds great to me!

@rbtcollins
Copy link
Contributor

I concur.

There is a UI principle: make the common case easy, make the rare case possible.

This case is already possible.

It is not (based on how often it is asked for, and the context when it is asked for) a common case.

So - if it isn't documented, lets document it better. But I don't think we should make the common case harder by adding more prompts.

@rbtcollins
Copy link
Contributor

And the docs were added 4 years back. #618 (comment)

@rbtcollins rbtcollins closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2023
@djc
Copy link
Contributor

djc commented Oct 2, 2023

Current docs:

djc-2021 update-deps pulumi $ ./rustup-init

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

  /Users/djc/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:

  /Users/djc/.cargo

This can be modified with the CARGO_HOME environment variable.

So yes, this seems pretty friendly to me already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants