nixpkgs-mozilla icon indicating copy to clipboard operation
nixpkgs-mozilla copied to clipboard

rust-overlay's rust package installs some optional extensions by default

Open Arnavion opened this issue 6 years ago • 1 comments

The rust-overlay invokes the tarball's install.sh, which in the case of the rust package's tarball also ends up installing clippy-preview, rustfmt-preview, rust-analysis, rls-preview, etc that are optional extensions. This is because these happen to be bundled in the same tarball and listed in its components file, so invoking install.sh installs them by default. This somewhat defeats the purpose of the extensions override for the package since these are going to get installed regardless (though it does help ensure that releases without the specified extensions can't be installed), and more importantly is an unnecessary waste of disk space.

Would it make sense for the overlay to invoke ./install.sh with CFG_COMPONENTS='<list of components>' where <list of components> are all the things listed as [[components]] in the dist manifest? ie CFG_COMPONENTS='cargo,rustc,rust-docs,rust-std' CFG_DISABLE_LDCONFIG=1 ./install.sh --prefix=$out --verbose (except determined by parsing the manifest dynamically). This would also match rustup's behavior since it too defaults to installing only required components.

Edit: A counterargument is that it would be a breaking change to do this now, since there are probably users who now expect these extensions to be installed by default. I don't know what the policy for breaking changes is.

Arnavion avatar May 31 '19 09:05 Arnavion

I also noticed that adding "rust-std" to extensions has no effect, as it's included by default - however, oddly enough, nix thinks it's a new derivation and you end up with two derivations in the nix store which differ only in their path but otherwise the directory contents is identical

NickHu avatar Oct 22 '20 15:10 NickHu