2017-10-29 20:32:40 +00:00
|
|
|
{ stdenv, lib, runCommand, patchelf
|
2017-04-15 11:36:29 +01:00
|
|
|
, fetchFromGitHub, rustPlatform
|
|
|
|
, pkgconfig, curl, Security }:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
name = "rustup-${version}";
|
2018-07-22 10:27:06 +01:00
|
|
|
version = "1.13.0";
|
2017-04-15 11:36:29 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rust-lang-nursery";
|
|
|
|
repo = "rustup.rs";
|
2018-02-20 20:42:18 +00:00
|
|
|
rev = version;
|
2018-07-22 10:27:06 +01:00
|
|
|
sha256 = "1h0786jx64nc9q8x6fv7a5sf1xijxhn02m2pq5v2grl9ks0vxidn";
|
2017-04-15 11:36:29 +01:00
|
|
|
};
|
|
|
|
|
2018-07-22 10:27:06 +01:00
|
|
|
cargoSha256 = "09lbm2k189sri3vwcwzv7j07ah39c8ajbpkg0kzvjsjwr7ypli8a";
|
|
|
|
|
2017-04-15 11:36:29 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
curl
|
|
|
|
] ++ stdenv.lib.optionals stdenv.isDarwin [ Security ];
|
|
|
|
|
|
|
|
cargoBuildFlags = [ "--features no-self-update" ];
|
|
|
|
|
|
|
|
patches = lib.optionals stdenv.isLinux [
|
2017-10-29 20:32:40 +00:00
|
|
|
(runCommand "0001-dynamically-patchelf-binaries.patch" { CC=stdenv.cc; patchelf = patchelf; } ''
|
2017-04-15 11:36:29 +01:00
|
|
|
export dynamicLinker=$(cat $CC/nix-support/dynamic-linker)
|
2017-10-29 20:32:40 +00:00
|
|
|
substitute ${./0001-dynamically-patchelf-binaries.patch} $out \
|
|
|
|
--subst-var patchelf \
|
|
|
|
--subst-var dynamicLinker
|
2017-04-15 11:36:29 +01:00
|
|
|
'')
|
|
|
|
];
|
|
|
|
|
2018-07-22 10:27:06 +01:00
|
|
|
doCheck = !stdenv.isAarch64;
|
|
|
|
|
2017-04-15 11:36:29 +01:00
|
|
|
postInstall = ''
|
|
|
|
pushd $out/bin
|
|
|
|
mv rustup-init rustup
|
2018-07-22 10:27:06 +01:00
|
|
|
for link in cargo rustc rustdoc rust-gdb rust-lldb rls rustfmt cargo-fmt cargo-clippy; do
|
2017-04-15 11:36:29 +01:00
|
|
|
ln -s rustup $link
|
|
|
|
done
|
|
|
|
popd
|
|
|
|
|
|
|
|
# tries to create .rustup
|
|
|
|
export HOME=$(mktemp -d)
|
2018-02-20 20:42:18 +00:00
|
|
|
mkdir -p "$out/share/"{bash-completion/completions,fish/vendor_completions.d,zsh/site-functions}
|
2017-04-15 11:36:29 +01:00
|
|
|
$out/bin/rustup completions bash > "$out/share/bash-completion/completions/rustup"
|
2018-02-20 20:42:18 +00:00
|
|
|
$out/bin/rustup completions fish > "$out/share/fish/vendor_completions.d/rustup.fish"
|
2017-04-15 11:36:29 +01:00
|
|
|
$out/bin/rustup completions zsh > "$out/share/zsh/site-functions/_rustup"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "The Rust toolchain installer";
|
|
|
|
homepage = https://www.rustup.rs/;
|
2018-02-20 20:42:18 +00:00
|
|
|
license = with licenses; [ asl20 /* or */ mit ];
|
2017-12-05 22:20:11 +00:00
|
|
|
maintainers = [ maintainers.mic92 ];
|
2017-04-15 11:36:29 +01:00
|
|
|
};
|
|
|
|
}
|