at 18.03-beta 1.8 kB view raw
1{ stdenv, lib, runCommand, patchelf 2, fetchFromGitHub, rustPlatform 3, pkgconfig, curl, Security }: 4 5rustPlatform.buildRustPackage rec { 6 name = "rustup-${version}"; 7 version = "1.11.0"; 8 9 cargoSha256 = "1r9mnj3x9sn16hi1r09gl5q0cnsa2g6kbjw2g115858i2a9k6hkr"; 10 11 src = fetchFromGitHub { 12 owner = "rust-lang-nursery"; 13 repo = "rustup.rs"; 14 rev = version; 15 sha256 = "05rbgkz4fk6c1x6bpmpx108bg2qcrf6vv3yfz378s7bmr3l319iz"; 16 }; 17 18 nativeBuildInputs = [ pkgconfig ]; 19 20 buildInputs = [ 21 curl 22 ] ++ stdenv.lib.optionals stdenv.isDarwin [ Security ]; 23 24 cargoBuildFlags = [ "--features no-self-update" ]; 25 26 patches = lib.optionals stdenv.isLinux [ 27 (runCommand "0001-dynamically-patchelf-binaries.patch" { CC=stdenv.cc; patchelf = patchelf; } '' 28 export dynamicLinker=$(cat $CC/nix-support/dynamic-linker) 29 substitute ${./0001-dynamically-patchelf-binaries.patch} $out \ 30 --subst-var patchelf \ 31 --subst-var dynamicLinker 32 '') 33 ]; 34 35 postInstall = '' 36 pushd $out/bin 37 mv rustup-init rustup 38 for link in cargo rustc rustdoc rust-gdb rust-lldb rls rustfmt cargo-fmt; do 39 ln -s rustup $link 40 done 41 popd 42 43 # tries to create .rustup 44 export HOME=$(mktemp -d) 45 mkdir -p "$out/share/"{bash-completion/completions,fish/vendor_completions.d,zsh/site-functions} 46 $out/bin/rustup completions bash > "$out/share/bash-completion/completions/rustup" 47 $out/bin/rustup completions fish > "$out/share/fish/vendor_completions.d/rustup.fish" 48 $out/bin/rustup completions zsh > "$out/share/zsh/site-functions/_rustup" 49 ''; 50 51 meta = with stdenv.lib; { 52 description = "The Rust toolchain installer"; 53 homepage = https://www.rustup.rs/; 54 license = with licenses; [ asl20 /* or */ mit ]; 55 maintainers = [ maintainers.mic92 ]; 56 }; 57}