rust-lang / rustup

The Rust toolchain installer
https://rust-lang.github.io/rustup/
Apache License 2.0
6.18k stars 892 forks source link

Provide post-unpack and/or post-download hooks #673

Open the-kenny opened 8 years ago

the-kenny commented 8 years ago

Sorry for the long introduction, I'll try to keep it short:

I'm maintaining rust packages for NixOS, a linux distribution with an unique (purely functional) approach to packaging. Packages are reproducible, isolated, and immutable. One thing we do for this is to patch our binaries to use absolute paths for dynamically loaded libraries while not having a "classic" /lib or /usr/lib directory.

This also means that it's unfortunately not possible to run "normal" binaries (without absolute paths to dependencies or /lib/ld-linux.so) without patching them first. This also means that it's impossible to use the toolchains downloaded by rustup.rs as-is without patching them first.

I want to suggest adding an option to rustup.rs that will run a hook (any shell script or executable) right after switching (or downloading, doesn't really matter) of the toolchain. This would allow us to patch the toolchains and make rustup.rs usable on NixOS.

The great benefit of rustup.rs compared to rustc and cargo in NixOS itself is that it makes it very easy to use recent nightly and beta builds. Right now these lack behind and they will get built from source as there isn't a binary substitution available from our build server (there is one for rustc-stable & cargo-stable).

Is there a chance for such a feature to make it into rustup.rs? If someone can give me some pointers on where to start I'd be happy to take this on myself.

the-kenny commented 8 years ago

Any comments here? Is this a feature that could make it into rustup?

crawford commented 7 years ago

This has become more of a problem lately because rustup update downloads rustup-init and then immediately runs it (which fails for the reasons listed above). Before, I could at least download and patch rustup and then the subsequently downloaded binaries (mainly rustc and cargo). Until we have a facility like the one mentioned above, I cannot update Rust on my system.

EDIT: I just found https://github.com/mozilla/nixpkgs-mozilla which appears to solve my issue.

the-kenny commented 7 years ago

The overlay from mozilla is very nice indeed, however I'd still prefer to be able to run rustup if necessary on my machine.

cyplo commented 5 years ago

Heya ! Any news on this one ? Is it generally okay to implement such hooks, just no one has any bandwidth or is there a problem with the concept itself ? Thanks !

kinnison commented 5 years ago

I don't think anyone in rustup has experience with NixOS and as such there's little interest for the limited bandwidth we do have. If you feel up to providing a PR, I'd be very happy to help you get it into a mergeable state.

Mawfyy commented 8 months ago

Some news about this?

djc commented 8 months ago

The state is the same as in the previous comment:

I don't think anyone in rustup has experience with NixOS and as such there's little interest for the limited bandwidth we do have. If you feel up to providing a PR, I'd be very happy to help you get it into a mergeable state.