19 libPath = lib.makeLibraryPath [
24 rustPlatform.buildRustPackage rec {
28 src = fetchFromGitHub {
32 sha256 = "sha256-rdhG9MdjWyvoaMGdjgFyCfQaoV48QtAZE7buA5TkDKg=";
36 lockFile = ./Cargo.lock;
39 nativeBuildInputs = [ makeBinaryWrapper pkg-config ];
42 (curl.override { inherit openssl; })
44 ] ++ lib.optionals stdenv.isDarwin [ CoreServices Security libiconv xz ];
46 buildFeatures = [ "no-self-update" ];
50 patches = lib.optionals stdenv.isLinux [
51 (runCommand "0001-dynamically-patchelf-binaries.patch" { CC = stdenv.cc; patchelf = patchelf; libPath = "$ORIGIN/../lib:${libPath}"; } ''
52 export dynamicLinker=$(cat $CC/nix-support/dynamic-linker)
53 substitute ${./0001-dynamically-patchelf-binaries.patch} $out \
54 --subst-var patchelf \
55 --subst-var dynamicLinker \
60 doCheck = !stdenv.isAarch64 && !stdenv.isDarwin;
64 # auto-self-update mode is set to 'disable' for nix rustup
65 "--skip=suite::cli_exact::check_updates_none"
66 "--skip=suite::cli_exact::check_updates_some"
67 "--skip=suite::cli_exact::check_updates_with_update"
68 # rustup-init is not used in nix rustup
69 "--skip=suite::cli_ui::rustup_init_ui_doc_text_tests"
76 cargo rustc rustdoc rust-gdb rust-lldb rls rustfmt cargo-fmt
77 cargo-clippy clippy-driver cargo-miri rust-gdbgui rust-analyzer
79 for link in ''${binlinks[@]}; do
84 wrapProgram $out/bin/rustup --prefix "LD_LIBRARY_PATH" : "${libPath}"
86 # tries to create .rustup
87 export HOME=$(mktemp -d)
88 mkdir -p "$out/share/"{bash-completion/completions,fish/vendor_completions.d,zsh/site-functions}
90 # generate completion scripts for rustup
91 $out/bin/rustup completions bash rustup > "$out/share/bash-completion/completions/rustup"
92 $out/bin/rustup completions fish rustup > "$out/share/fish/vendor_completions.d/rustup.fish"
93 $out/bin/rustup completions zsh rustup > "$out/share/zsh/site-functions/_rustup"
95 # generate completion scripts for cargo
96 # Note: fish completion script is not supported.
97 $out/bin/rustup completions bash cargo > "$out/share/bash-completion/completions/cargo"
98 $out/bin/rustup completions zsh cargo > "$out/share/zsh/site-functions/_cargo"
102 description = "The Rust toolchain installer";
103 homepage = "https://www.rustup.rs/";
104 license = with licenses; [ asl20 /* or */ mit ];
105 maintainers = [ maintainers.mic92 ];