diff options
Diffstat (limited to 'nixpkgs/pkgs/development/tools/rust')
17 files changed, 853 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/tools/rust/bindgen/default.nix b/nixpkgs/pkgs/development/tools/rust/bindgen/default.nix new file mode 100644 index 000000000000..a1f5e5769ae8 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/bindgen/default.nix @@ -0,0 +1,63 @@ +{ stdenv, fetchFromGitHub, rustPlatform, clang, llvmPackages, rustfmt, writeScriptBin, + runtimeShell }: + +rustPlatform.buildRustPackage rec { + name = "rust-bindgen-${version}"; + version = "0.42.2"; + + src = fetchFromGitHub { + owner = "rust-lang-nursery"; + repo = "rust-bindgen"; + rev = "v${version}"; + sha256 = "10h0h7x8yf4dsyw2p2nas2jg5p3i29np0y3rfzrdq898d70gvq4j"; + }; + + cargoSha256 = "01jvi86xgz0r7ia9agnfpms6b6x68lzwj6f085m0w659i94acgpi"; + + libclang = llvmPackages.libclang.lib; #for substituteAll + + buildInputs = [ libclang ]; + + propagatedBuildInputs = [ clang ]; # to populate NIX_CXXSTDLIB_COMPILE + + configurePhase = '' + export LIBCLANG_PATH="${libclang}/lib" + ''; + + postInstall = '' + mv $out/bin/{bindgen,.bindgen-wrapped}; + substituteAll ${./wrapper.sh} $out/bin/bindgen + chmod +x $out/bin/bindgen + ''; + + doCheck = true; + checkInputs = + let fakeRustup = writeScriptBin "rustup" '' + #!${runtimeShell} + shift + shift + exec "$@" + ''; + in [ + rustfmt + fakeRustup # the test suite insists in calling `rustup run nightly rustfmt` + clang + ]; + preCheck = '' + # for the ci folder, notably + patchShebangs . + ''; + + meta = with stdenv.lib; { + description = "C and C++ binding generator"; + longDescription = '' + Bindgen takes a c or c++ header file and turns them into + rust ffi declarations. + As with most compiler related software, this will only work + inside a nix-shell with the required libraries as buildInputs. + ''; + homepage = https://github.com/rust-lang-nursery/rust-bindgen; + license = with licenses; [ bsd3 ]; + maintainers = [ maintainers.ralith ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/bindgen/wrapper.sh b/nixpkgs/pkgs/development/tools/rust/bindgen/wrapper.sh new file mode 100755 index 000000000000..95cd0901cec8 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/bindgen/wrapper.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +sep='--' # whether to add -- before new options +cxx=0 # whether cxx was explicitly requested +lastWasx=0 # whether the last argument passed was -x +for e in "$@"; do + if [[ "$e" == "--" ]]; then + sep= + fi; + if [[ "$sep" == "" ]]; then + # we look for -x c++ after -- only + if [[ "$e" == "-x" ]]; then + lastWasx=1 + fi; + if [[ $lastWasx -eq 1 && "$e" == "c++" ]]; then + lastWasx=0 + cxx=1 + fi; + if [[ "$e" == "-xc++" || "$e" == -std=c++* ]]; then + cxx=1 + fi; + fi; +done; +cxxflags= +if [[ $cxx -eq 1 ]]; then + cxxflags=$NIX_CXXSTDLIB_COMPILE +fi; +if [[ -n "$NIX_DEBUG" ]]; then + set -x; +fi; +export LIBCLANG_PATH="@libclang@/lib" +# shellcheck disable=SC2086 +# cxxflags and NIX_CFLAGS_COMPILE should be word-split +exec -a "$0" @out@/bin/.bindgen-wrapped "$@" $sep $cxxflags $NIX_CFLAGS_COMPILE +# note that we add the flags after $@ which is incorrect. This is only for the sake +# of simplicity. + diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-asm/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-asm/default.nix new file mode 100644 index 000000000000..246f5b18843c --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-asm/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchFromGitHub, rustPlatform, Security }: + +rustPlatform.buildRustPackage rec { + name = "cargo-asm-${version}"; + version = "0.1.16"; + + src = fetchFromGitHub { + owner = "gnzlbg"; + repo = "cargo-asm"; + rev = "7d0ece74657edb002bd8530227b829b31fd19dcd"; + sha256 = "0mzbh5zw5imlaagm5zjbjk9kqdnglm398rxkqisd22h6569ppqpc"; + }; + + cargoSha256 = "1m2j6i8hc8isdlj77gv9m6sk6q0x3bvzpva2k16g27i1ngy1989b"; + + buildInputs = stdenv.lib.optional stdenv.isDarwin Security; + + # Test checks against machine code output, which fails with some + # LLVM/compiler versions. + doCheck = false; + + meta = with stdenv.lib; { + description = "Display the assembly or LLVM-IR generated for Rust source code"; + homepage = https://github.com/gnzlbg/cargo-asm; + license = licenses.mit; + maintainers = [ maintainers.danieldk ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-fuzz/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-fuzz/default.nix new file mode 100644 index 000000000000..cc5d90b223d6 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-fuzz/default.nix @@ -0,0 +1,35 @@ +{ stdenv, fetchFromGitHub, fetchurl, runCommand, rustPlatform }: + +rustPlatform.buildRustPackage rec { + name = "cargo-fuzz-${version}"; + version = "0.5.3"; # Note to self: on 0.5.4, remove the hand-added Cargo.lock + + src = + let + source = fetchFromGitHub { + owner = "rust-fuzz"; + repo = "cargo-fuzz"; + rev = version; + sha256 = "1l452fnjw7i10nrd4y4rssi5d457vgjp6rhdr9cnq32bjhdkprrs"; + }; + cargo-lock = fetchurl { + url = "https://gist.githubusercontent.com/Ekleog/7d5b62d13b7207aafa4c37d1bbdf2de7/raw/c6027fc1c531947f4d6836a3c4cba1b3e24df24c/Cargo.lock"; + sha256 = "0d7b6kxfbfvwksybzrihylamg2zv5fmsk9m6xshryhwipskzzvmd"; + }; + in + runCommand "cargo-fuzz-src" {} '' + cp -R ${source} $out + chmod +w $out + cp ${cargo-lock} $out/Cargo.lock + ''; + + cargoSha256 = "0ajm8qp8hi7kn7199ywv26cmjv13phxv72lz8kcq97hxg17x0dkk"; + + meta = with stdenv.lib; { + description = "Command line helpers for fuzzing"; + homepage = https://github.com/rust-fuzz/cargo-fuzz; + license = with licenses; [ mit asl20 ]; + maintainers = [ maintainers.ekleog ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cbindgen/default.nix b/nixpkgs/pkgs/development/tools/rust/cbindgen/default.nix new file mode 100644 index 000000000000..6b14f49716f2 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cbindgen/default.nix @@ -0,0 +1,24 @@ +{ stdenv, fetchFromGitHub, rustPlatform, Security }: + +rustPlatform.buildRustPackage rec { + name = "rust-cbindgen-${version}"; + version = "0.6.7"; + + src = fetchFromGitHub { + owner = "eqrion"; + repo = "cbindgen"; + rev = "v${version}"; + sha256 = "0sgkgvkqrc6l46fvk6d9hsy0xrjpl2ix47f3cv5bi74dv8i4y2b4"; + }; + + cargoSha256 = "137dqj1sp02dh0dz9psf8i8q57gmz3rfgmwk073k7x5zzkgvj21c"; + + buildInputs = stdenv.lib.optional stdenv.isDarwin Security; + + meta = with stdenv.lib; { + description = "A project for generating C bindings from Rust code"; + homepage = https://github.com/eqrion/cbindgen; + license = licenses.mpl20; + maintainers = with maintainers; [ jtojnar ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/pyo3-pack/default.nix b/nixpkgs/pkgs/development/tools/rust/pyo3-pack/default.nix new file mode 100644 index 000000000000..05c57e46b893 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/pyo3-pack/default.nix @@ -0,0 +1,35 @@ +{ stdenv, fetchFromGitHub, rustPlatform, dbus, gmp, openssl, pkgconfig +, darwin }: + +let + inherit (darwin.apple_sdk.frameworks) Security; +in rustPlatform.buildRustPackage rec { + name = "pyo3-pack-${version}"; + version = "0.3.8"; + + src = fetchFromGitHub { + owner = "PyO3"; + repo = "pyo3-pack"; + rev = "v${version}"; + sha256 = "14343209w7wphkqh7pnw08pah09spjbwhk6l548g9ivra057gwaz"; + }; + + cargoSha256 = "0n7z9p3v92ijqc2ix60wi74as5rql61k5qbqi8b1b02b71xmsp7j"; + + nativeBuildInputs = [ pkgconfig ]; + + buildInputs = [ gmp openssl ] + ++ stdenv.lib.optional stdenv.isDarwin Security + ++ stdenv.lib.optional stdenv.isLinux dbus; + + # Requires network access, fails in sandbox. + doCheck = false; + + meta = with stdenv.lib; { + description = "Build and publish crates with pyo3 bindings as python packages"; + homepage = https://github.com/PyO3/pyo3-pack; + license = licenses.mit; + maintainers = [ maintainers.danieldk ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/racer/default.nix b/nixpkgs/pkgs/development/tools/rust/racer/default.nix new file mode 100644 index 000000000000..8474f99bc8b9 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/racer/default.nix @@ -0,0 +1,37 @@ +{ stdenv, fetchFromGitHub, rustPlatform, makeWrapper, substituteAll }: + +rustPlatform.buildRustPackage rec { + name = "racer-${version}"; + version = "2.0.14"; + + src = fetchFromGitHub { + owner = "racer-rust"; + repo = "racer"; + rev = version; + sha256 = "0kgax74qa09axq7b175ph3psprgidwgsml83wm1qwdq16gpxiaif"; + }; + + cargoSha256 = "1j3fviimdxn6xa75z0l9wkgdnznp8q20jjs42mql6ql782dga5lk"; + + buildInputs = [ makeWrapper ]; + + preCheck = '' + export RUST_SRC_PATH="${rustPlatform.rustcSrc}" + ''; + patches = [ + (substituteAll { + src = ./rust-src.patch; + inherit (rustPlatform) rustcSrc; + }) + ./ignore-tests.patch + ]; + doCheck = true; + + meta = with stdenv.lib; { + description = "A utility intended to provide Rust code completion for editors and IDEs"; + homepage = https://github.com/racer-rust/racer; + license = licenses.mit; + maintainers = with maintainers; [ jagajaga globin ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/racer/ignore-tests.patch b/nixpkgs/pkgs/development/tools/rust/racer/ignore-tests.patch new file mode 100644 index 000000000000..021217b4094e --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/racer/ignore-tests.patch @@ -0,0 +1,22 @@ +diff -Naur --strip-trailing-cr source.org/src/racer/nameres.rs source/src/racer/nameres.rs +--- source.org/src/racer/nameres.rs 2017-11-15 20:37:38.571644733 +0000 ++++ source/src/racer/nameres.rs 2017-11-15 20:23:20.521324031 +0000 +@@ -577,6 +577,7 @@ + out.into_iter() + } + ++#[ignore] + #[test] + fn test_do_file_search() { + let cache = core::FileCache::default(); +diff -Naur --strip-trailing-cr source.org/src/racer/util.rs source/src/racer/util.rs +--- source.org/src/racer/util.rs 2017-11-15 19:37:55.095344120 +0000 ++++ source/src/racer/util.rs 2017-11-15 20:22:53.746624158 +0000 +@@ -475,6 +475,7 @@ + + } + ++#[ignore] + #[test] + fn test_get_rust_src_path_missing() { + use std::env; diff --git a/nixpkgs/pkgs/development/tools/rust/racer/rust-src.patch b/nixpkgs/pkgs/development/tools/rust/racer/rust-src.patch new file mode 100644 index 000000000000..2e794ac88874 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/racer/rust-src.patch @@ -0,0 +1,10 @@ +--- source.org/src/racer/util.rs 1970-01-01 01:00:01.000000000 +0100 ++++ source/src/racer/util.rs 2017-11-15 16:50:12.904216242 +0000 +@@ -384,6 +384,7 @@ + debug!("Nope. Trying default paths: /usr/local/src/rust/src and /usr/src/rust/src"); + + let default_paths = [ ++ "@rustcSrc@", + "/usr/local/src/rust/src", + "/usr/src/rust/src", + ]; diff --git a/nixpkgs/pkgs/development/tools/rust/racerd/default.nix b/nixpkgs/pkgs/development/tools/rust/racerd/default.nix new file mode 100644 index 000000000000..058185acdbe4 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/racerd/default.nix @@ -0,0 +1,35 @@ +{ stdenv, fetchFromGitHub, rustPlatform, makeWrapper }: + +with rustPlatform; + +buildRustPackage rec { + name = "racerd-${version}"; + version = "2017-09-15"; + src = fetchFromGitHub { + owner = "jwilm"; + repo = "racerd"; + rev = "29cd4c6fd2a9301e49931c2e065b2e10c4b587e4"; + sha256 = "0knz881mjhd8q2i8ydggaa7lfpiqy11wjmnv5p80n1d8zca6yb7z"; + }; + + doCheck = false; + + cargoSha256 = "00gxj98zdkbrc5cxd4w5hk7iwv9a1kwa535hhspx9xd02r4d8rzl"; + + buildInputs = [ makeWrapper ]; + + RUST_SRC_PATH = rustPlatform.rustcSrc; + + installPhase = '' + mkdir -p $out/bin + cp -p target/release/racerd $out/bin/ + wrapProgram $out/bin/racerd --set RUST_SRC_PATH "$RUST_SRC_PATH" + ''; + + meta = with stdenv.lib; { + description = "JSON/HTTP Server based on racer for adding Rust support to editors and IDEs"; + homepage = https://github.com/jwilm/racerd; + license = licenses.asl20; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/rainicorn/default.nix b/nixpkgs/pkgs/development/tools/rust/rainicorn/default.nix new file mode 100644 index 000000000000..50c890e3c47e --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/rainicorn/default.nix @@ -0,0 +1,25 @@ +{ stdenv, fetchFromGitHub, rustPlatform }: + +with rustPlatform; + +buildRustPackage rec { + name = "rainicorn-${version}"; + version = "1.0.0"; + + src = fetchFromGitHub { + owner = "RustDT"; + repo = "Rainicorn"; + rev = "0f8594079a7f302f4940cc4320f5e4f39f95cdc4"; + sha256 = "07vh4g120sx569wkzclq91blkkd7q7z582pl8vz0li1l9ij8md01"; + }; + + cargoSha256 = "14kd25mw6m20blqcr221cclcqxw0j229zxq8hsaay6q7jgv0c7a0"; + + meta = with stdenv.lib; { + broken = true; + description = "Rust IDEs. parse-analysis"; + homepage = https://github.com/RustDT/Rainicorn; + license = with licenses; [ mit asl20 ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/rls/default.nix b/nixpkgs/pkgs/development/tools/rust/rls/default.nix new file mode 100644 index 000000000000..accdc7678c60 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/rls/default.nix @@ -0,0 +1,43 @@ +{ stdenv, fetchFromGitHub, rustPlatform +, openssh, openssl, pkgconfig, cmake, zlib, curl }: + +rustPlatform.buildRustPackage rec { + name = "rls-${version}"; + # with rust 1.x you can only build rls version 1.x.y + version = "1.31.7"; + + src = fetchFromGitHub { + owner = "rust-lang"; + repo = "rls"; + rev = version; + sha256 = "0n33pf7sm31y55rllb8wv3mn75srspr4yj2y6cpcdyf15n47c8cf"; + }; + + cargoSha256 = "0jcsggq4ay8f4vb8n6gh8z995icvvbjkzapxf6jq6qkg6jp3vv17"; + + # a nightly compiler is required unless we use this cheat code. + RUSTC_BOOTSTRAP=1; + + # clippy is hard to build with stable rust so we disable clippy lints + cargoBuildFlags = [ "--no-default-features" ]; + + nativeBuildInputs = [ pkgconfig cmake ]; + buildInputs = [ openssh openssl curl zlib ]; + + doCheck = true; + # the default checkPhase has no way to pass --no-default-features + checkPhase = '' + runHook preCheck + echo "Running cargo test" + cargo test --no-default-features + runHook postCheck + ''; + + meta = with stdenv.lib; { + description = "Rust Language Server - provides information about Rust programs to IDEs and other tools"; + homepage = https://github.com/rust-lang/rls/; + license = licenses.mit; + maintainers = with maintainers; [ symphorien ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/rustfmt/default.nix b/nixpkgs/pkgs/development/tools/rust/rustfmt/default.nix new file mode 100644 index 000000000000..dac00aa4c969 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/rustfmt/default.nix @@ -0,0 +1,34 @@ +{ stdenv, fetchFromGitHub, rustPlatform, darwin }: + +rustPlatform.buildRustPackage rec { + name = "rustfmt-${version}"; + version = "1.0.1"; + + src = fetchFromGitHub { + owner = "rust-lang"; + repo = "rustfmt"; + rev = "${version}"; + sha256 = "1l18ycbq3125sq8v3wgma630wd6kclarlf8f51cmi9blk322jg9p"; + }; + + cargoSha256 = "1557783icdzlwn02c5zl4362yl85r5zj4nkjv80p6896yli9hk9h"; + + buildInputs = stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security; + + # As of 1.0.0 and rustc 1.30 rustfmt requires a nightly compiler + RUSTC_BOOTSTRAP = 1; + + # we run tests in debug mode so tests look for a debug build of + # rustfmt. Anyway this adds nearly no compilation time. + preCheck = '' + cargo build + ''; + + meta = with stdenv.lib; { + description = "A tool for formatting Rust code according to style guidelines"; + homepage = https://github.com/rust-lang-nursery/rustfmt; + license = with licenses; [ mit asl20 ]; + maintainers = [ maintainers.globin ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/rustup/0001-dynamically-patchelf-binaries.patch b/nixpkgs/pkgs/development/tools/rust/rustup/0001-dynamically-patchelf-binaries.patch new file mode 100644 index 000000000000..60f29fccdc34 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/rustup/0001-dynamically-patchelf-binaries.patch @@ -0,0 +1,51 @@ +From c21cc756b69a5f33c8a7758b746a816f40f55932 Mon Sep 17 00:00:00 2001 +From: Leon Isenberg <ljli@users.noreply.github.com> +Date: Sat, 28 Oct 2017 17:58:17 +0200 +Subject: [PATCH] nix customization: patchelf installed binaries + +--- + src/rustup-dist/src/component/package.rs | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/src/rustup-dist/src/component/package.rs b/src/rustup-dist/src/component/package.rs +index 70c54dcd..f0318986 100644 +--- a/src/rustup-dist/src/component/package.rs ++++ b/src/rustup-dist/src/component/package.rs +@@ -100,7 +100,10 @@ impl Package for DirectoryPackage { + let src_path = root.join(&path); + + match &*part.0 { +- "file" => builder.copy_file(path.clone(), &src_path)?, ++ "file" => { ++ builder.copy_file(path.clone(), &src_path)?; ++ nix_patchelf_if_needed(&target.prefix().path().join(path.clone()), &src_path) ++ } + "dir" => builder.copy_dir(path.clone(), &src_path)?, + _ => return Err(ErrorKind::CorruptComponent(name.to_owned()).into()), + } +@@ -118,6 +121,22 @@ impl Package for DirectoryPackage { + } + } + ++fn nix_patchelf_if_needed(dest_path: &Path, src_path: &Path) { ++ let is_bin = if let Some(p) = src_path.parent() { ++ p.ends_with("bin") ++ } else { ++ false ++ }; ++ ++ if is_bin { ++ let _ = ::std::process::Command::new("@patchelf@/bin/patchelf") ++ .arg("--set-interpreter") ++ .arg("@dynamicLinker@") ++ .arg(dest_path) ++ .output(); ++ } ++} ++ + // On Unix we need to set up the file permissions correctly so + // binaries are executable and directories readable. This shouldn't be + // necessary: the source files *should* have the right permissions, +-- +2.17.1 + diff --git a/nixpkgs/pkgs/development/tools/rust/rustup/default.nix b/nixpkgs/pkgs/development/tools/rust/rustup/default.nix new file mode 100644 index 000000000000..1177423869c1 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/rustup/default.nix @@ -0,0 +1,63 @@ +{ stdenv, lib, runCommand, patchelf +, fetchFromGitHub, rustPlatform +, pkgconfig, curl, Security }: + +rustPlatform.buildRustPackage rec { + name = "rustup-${version}"; + version = "1.17.0"; + + src = fetchFromGitHub { + owner = "rust-lang"; + repo = "rustup.rs"; + rev = version; + sha256 = "1mf92z89wqqaj3cg2cqf6basvcz47krldmy8ianfkzp323fimqmn"; + }; + + cargoSha256 = "0y7kbihdrpd35dw24qqqzmccvjdy6arka10p5rnv38d420f1bpzd"; + + nativeBuildInputs = [ pkgconfig ]; + + buildInputs = [ + curl + ] ++ stdenv.lib.optionals stdenv.isDarwin [ Security ]; + + cargoBuildFlags = [ "--features no-self-update" ]; + + patches = lib.optionals stdenv.isLinux [ + (runCommand "0001-dynamically-patchelf-binaries.patch" { CC=stdenv.cc; patchelf = patchelf; } '' + export dynamicLinker=$(cat $CC/nix-support/dynamic-linker) + substitute ${./0001-dynamically-patchelf-binaries.patch} $out \ + --subst-var patchelf \ + --subst-var dynamicLinker + '') + ]; + + doCheck = !stdenv.isAarch64; + + postInstall = '' + pushd $out/bin + mv rustup-init rustup + binlinks=( + cargo rustc rustdoc rust-gdb rust-lldb rls rustfmt cargo-fmt + cargo-clippy clippy-driver cargo-miri + ) + for link in ''${binlinks[@]}; do + ln -s rustup $link + done + popd + + # tries to create .rustup + export HOME=$(mktemp -d) + mkdir -p "$out/share/"{bash-completion/completions,fish/vendor_completions.d,zsh/site-functions} + $out/bin/rustup completions bash > "$out/share/bash-completion/completions/rustup" + $out/bin/rustup completions fish > "$out/share/fish/vendor_completions.d/rustup.fish" + $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/; + license = with licenses; [ asl20 /* or */ mit ]; + maintainers = [ maintainers.mic92 ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/svd2rust/cargo-lock.patch b/nixpkgs/pkgs/development/tools/rust/svd2rust/cargo-lock.patch new file mode 100644 index 000000000000..5cd1f685fc11 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/svd2rust/cargo-lock.patch @@ -0,0 +1,283 @@ +diff --git a/Cargo.lock b/Cargo.lock +new file mode 100644 +--- /dev/null ++++ b/Cargo.lock +@@ -0,0 +1,278 @@ ++[[package]] ++name = "ansi_term" ++version = "0.11.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "atty" ++version = "0.2.11" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ++ "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ++ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "autocfg" ++version = "0.1.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "backtrace" ++version = "0.3.13" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ++ "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", ++ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ++ "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ++ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "backtrace-sys" ++version = "0.1.28" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "bitflags" ++version = "0.7.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "bitflags" ++version = "1.0.4" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "cast" ++version = "0.2.2" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "cc" ++version = "1.0.28" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "cfg-if" ++version = "0.1.6" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "clap" ++version = "2.32.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ++ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ++ "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ++ "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "either" ++version = "1.5.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "error-chain" ++version = "0.11.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "inflections" ++version = "1.1.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "libc" ++version = "0.2.46" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "quote" ++version = "0.3.15" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "redox_syscall" ++version = "0.1.50" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "redox_termios" ++version = "0.1.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "rustc-demangle" ++version = "0.1.13" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "strsim" ++version = "0.7.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "svd-parser" ++version = "0.6.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "xmltree 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "svd2rust" ++version = "0.14.0" ++dependencies = [ ++ "cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ++ "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "inflections 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ++ "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ++ "svd-parser 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "syn" ++version = "0.11.11" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ++ "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", ++ "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "synom" ++version = "0.11.3" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "termion" ++version = "1.5.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ++ "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", ++ "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "textwrap" ++version = "0.10.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "unicode-width" ++version = "0.1.5" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "unicode-xid" ++version = "0.0.4" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "vec_map" ++version = "0.8.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "winapi" ++version = "0.3.6" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "winapi-i686-pc-windows-gnu" ++version = "0.4.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "winapi-x86_64-pc-windows-gnu" ++version = "0.4.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "xml-rs" ++version = "0.3.6" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "xmltree" ++version = "0.3.2" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "xml-rs 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[metadata] ++"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" ++"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" ++"checksum autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4e5f34df7a019573fb8bdc7e24a2bfebe51a2a1d6bfdbaeccedb3c41fc574727" ++"checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" ++"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" ++"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" ++"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" ++"checksum cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427" ++"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" ++"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" ++"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" ++"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" ++"checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3" ++"checksum inflections 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a257582fdcde896fd96463bf2d40eefea0580021c0712a0e2b028b60b47a837a" ++"checksum libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)" = "023a4cd09b2ff695f9734c1934145a315594b7986398496841c7031a5a1bbdbd" ++"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" ++"checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" ++"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" ++"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" ++"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" ++"checksum svd-parser 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f22b4579485b26262f36086d6b74903befc043a57f8377dfcf05bcf5335cb251" ++"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" ++"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" ++"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" ++"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" ++"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" ++"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" ++"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" ++"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" ++"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" ++"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" ++"checksum xml-rs 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7ec6c39eaa68382c8e31e35239402c0a9489d4141a8ceb0c716099a0b515b562" ++"checksum xmltree 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "472a9d37c7c53ab2391161df5b89b1f3bf76dab6ab150d7941ecbdd832282082" diff --git a/nixpkgs/pkgs/development/tools/rust/svd2rust/default.nix b/nixpkgs/pkgs/development/tools/rust/svd2rust/default.nix new file mode 100644 index 000000000000..2d61ac318e1f --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/svd2rust/default.nix @@ -0,0 +1,28 @@ +{ stdenv, fetchFromGitHub, rustPlatform }: + +with rustPlatform; + +buildRustPackage rec { + name = "svd2rust-${version}"; + version = "0.14.0"; + + src = fetchFromGitHub { + owner = "rust-embedded"; + repo = "svd2rust"; + rev = "v${version}"; + sha256 = "1a0ldmjkhyv5c52gcq8p8avkj0cgj1b367w6hm85bxdf5j4y8rra"; + }; + cargoPatches = [ ./cargo-lock.patch ]; + + cargoSha256 = "0wsiaa6q9hr9x1cbg6sc8ajg846jjci5qwhdga4d408fmqav72ih"; + + # doc tests fail due to missing dependency + doCheck = false; + + meta = with stdenv.lib; { + description = "Generate Rust register maps (`struct`s) from SVD files"; + homepage = https://github.com/rust-embedded/svd2rust; + license = with licenses; [ mit asl20 ]; + platforms = platforms.all; + }; +} |