diff options
Diffstat (limited to 'nixpkgs/pkgs/development/tools/rust')
63 files changed, 3772 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..cc3907ba7f29 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/bindgen/default.nix @@ -0,0 +1,75 @@ +{ lib, fetchFromGitHub, rustPlatform, clang, llvmPackages_latest, rustfmt, writeTextFile +, runtimeShell +, bash +}: + +rustPlatform.buildRustPackage rec { + pname = "rust-bindgen"; + version = "0.57.0"; + + RUSTFLAGS = "--cap-lints warn"; # probably OK to remove after update + + src = fetchFromGitHub { + owner = "rust-lang"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-0d8+Rkb4h1DoFUQ7u2/kPR/fUUz0YvI+hNT4iXL3mxY="; + }; + + cargoSha256 = "0r60smhlx1992a1s1k5sxjpdqllb2xsqcimgx3ldp5fdkfphk3cw"; + + #for substituteAll + libclang = llvmPackages_latest.libclang.lib; + inherit bash; + + buildInputs = [ libclang ]; + + propagatedBuildInputs = [ clang ]; # to populate NIX_CXXSTDLIB_COMPILE + + configurePhase = '' + export LIBCLANG_PATH="${libclang.lib}/lib" + ''; + + postInstall = '' + mv $out/bin/{bindgen,.bindgen-wrapped}; + substituteAll ${./wrapper.sh} $out/bin/bindgen + chmod +x $out/bin/bindgen + ''; + + doCheck = true; + checkInputs = + let fakeRustup = writeTextFile { + name = "fake-rustup"; + executable = true; + destination = "/bin/rustup"; + text = '' + #!${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 lib; { + description = "Automatically generates Rust FFI bindings to C (and some C++) libraries"; + 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/rust-bindgen"; + license = with licenses; [ bsd3 ]; + platforms = platforms.unix; + maintainers = with maintainers; [ johntitor 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..0b3e3cd4c1e0 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/bindgen/wrapper.sh @@ -0,0 +1,36 @@ +#!@bash@/bin/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..68d5a256bbf4 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-asm/default.nix @@ -0,0 +1,28 @@ +{ lib, stdenv, fetchFromGitHub, rustPlatform, Security }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-asm"; + version = "2019-12-24"; + + src = fetchFromGitHub { + owner = "gnzlbg"; + repo = "cargo-asm"; + rev = "577f890ebd4a09c8265710261e976fe7bfce8668"; + sha256 = "1f6kzsmxgdms9lq5z9ynnmxymk9k2lzlp3caa52wqjvdw1grw0rb"; + }; + + cargoSha256 = "1c22aal3i7zbyxr2c41fimfx13fwp9anmhh641951yd7cqb8xij2"; + + buildInputs = lib.optional stdenv.isDarwin Security; + + # Test checks against machine code output, which fails with some + # LLVM/compiler versions. + doCheck = false; + + meta = with lib; { + description = "Display the assembly or LLVM-IR generated for Rust source code"; + homepage = "https://github.com/gnzlbg/cargo-asm"; + license = licenses.mit; + maintainers = [ ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-binutils/Cargo.lock b/nixpkgs/pkgs/development/tools/rust/cargo-binutils/Cargo.lock new file mode 100644 index 000000000000..a1e4cdde3b87 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-binutils/Cargo.lock @@ -0,0 +1,419 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "addr2line" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" + +[[package]] +name = "aho-corasick" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +dependencies = [ + "memchr", +] + +[[package]] +name = "ansi_term" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee67c11feeac938fae061b232e38e0b6d94f97a9df10e6271319325ac4c56a86" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]] +name = "backtrace" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef5140344c85b01f9bbb4d4b7288a8aa4b3287ccef913a14bcc78a1063623598" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "cargo-binutils" +version = "0.3.3" +dependencies = [ + "anyhow", + "cargo_metadata", + "clap", + "regex", + "rustc-cfg", + "rustc-demangle", + "rustc_version", + "serde", + "toml", +] + +[[package]] +name = "cargo_metadata" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3a567c24b86754d629addc2db89e340ac9398d07b5875efcff837e3878e17ec" +dependencies = [ + "semver 0.10.0", + "serde", + "serde_json", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clap" +version = "2.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +dependencies = [ + "ansi_term", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", +] + +[[package]] +name = "failure" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" +dependencies = [ + "backtrace", + "failure_derive", +] + +[[package]] +name = "failure_derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "gimli" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" + +[[package]] +name = "hermit-abi" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" +dependencies = [ + "libc", +] + +[[package]] +name = "itoa" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb" + +[[package]] +name = "memchr" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" + +[[package]] +name = "miniz_oxide" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d" +dependencies = [ + "adler", + "autocfg", +] + +[[package]] +name = "object" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" + +[[package]] +name = "proc-macro2" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quote" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", + "thread_local", +] + +[[package]] +name = "regex-syntax" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189" + +[[package]] +name = "rustc-cfg" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ad221fe7cd09334f8735dcc157b1178e343f43dfaefcd1b09d7fd4fc0921b6f" +dependencies = [ + "failure", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + +[[package]] +name = "ryu" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "394cec28fa623e00903caf7ba4fa6fb9a0e260280bb8cdbbba029611108a0190" +dependencies = [ + "semver-parser", + "serde", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + +[[package]] +name = "syn" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4211ce9909eb971f111059df92c45640aad50a619cf55cd76476be803c4c68e6" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "synstructure" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "thread_local" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "toml" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] + +[[package]] +name = "unicode-width" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" + +[[package]] +name = "unicode-xid" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" + +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-binutils/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-binutils/default.nix new file mode 100644 index 000000000000..f499512ce532 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-binutils/default.nix @@ -0,0 +1,34 @@ +{ lib, fetchFromGitHub, rustPlatform, runCommand }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-binutils"; + version = "0.3.3"; + + # Upstream doesn't commit `Cargo.lock`, see https://github.com/rust-embedded/cargo-binutils/pull/99 + src = + let + repo = fetchFromGitHub { + owner = "rust-embedded"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-Dgn+f4aSsDSh+RC8yvt3ydkdtwib5jEVsnZkod5c7Vo="; + }; + in + runCommand "source" { } '' + cp -R ${repo} $out + chmod -R +w $out + cp ${./Cargo.lock} $out/Cargo.lock + ''; + + cargoSha256 = "sha256-6du86HxkDQAeIXScXBKuv0j4YZiG4O6IwVIXZnJgTO8="; + + meta = with lib; { + description = "Cargo subcommands to invoke the LLVM tools shipped with the Rust toolchain."; + longDescription = '' + In order for this to work, you either need to run `rustup component add llvm-tools-preview` or install the `llvm-tools-preview` component using your Nix library (e.g. nixpkgs-mozilla, or rust-overlay) + ''; + homepage = "https://github.com/rust-embedded/cargo-binutils"; + license = with licenses; [ asl20 mit ]; + maintainers = with maintainers; [ stupremee ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-bisect-rustc/0001-dynamically-patchelf-binaries.patch b/nixpkgs/pkgs/development/tools/rust/cargo-bisect-rustc/0001-dynamically-patchelf-binaries.patch new file mode 100644 index 000000000000..6a4967e96054 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-bisect-rustc/0001-dynamically-patchelf-binaries.patch @@ -0,0 +1,56 @@ +diff --git a/src/toolchains.rs b/src/toolchains.rs +index 4d85e7c..b1353c6 100644 +--- a/src/toolchains.rs ++++ b/src/toolchains.rs +@@ -259,6 +259,8 @@ impl Toolchain { + .map_err(InstallError::Download)?; + } + ++ nix_patchelf(tmpdir.path().to_path_buf()) ++ .expect("failed to patch toolchain for NixOS"); + fs::rename(tmpdir.into_path(), dest).map_err(InstallError::Move)?; + + Ok(()) +@@ -557,3 +559,42 @@ pub(crate) fn download_tarball( + } + download_tar_gz(client, name, &format!("{}.gz", url,), strip_prefix, dest) + } ++ ++fn nix_patchelf(mut toolchain_path: PathBuf) -> Result<(), Error> { ++ toolchain_path.push("bin"); ++ ++ for entry in toolchain_path.read_dir()? { ++ let entry = entry?; ++ if !entry.file_type()?.is_file() { ++ continue; ++ } ++ ++ eprintln!("info: you seem to be running NixOS. Attempting to patch {}", ++ entry.path().to_str().unwrap()); ++ let _ = ::std::process::Command::new("@patchelf@/bin/patchelf") ++ .arg("--set-interpreter") ++ .arg("@dynamicLinker@") ++ .arg(entry.path()) ++ .output(); ++ } ++ ++ toolchain_path.pop(); ++ toolchain_path.push("lib"); ++ ++ for entry in toolchain_path.read_dir()? { ++ let entry = entry?; ++ if !entry.file_type()?.is_file() { ++ continue; ++ } ++ ++ eprintln!("info: you seem to be running NixOS. Attempting to patch {}", ++ entry.path().to_str().unwrap()); ++ let _ = ::std::process::Command::new("@patchelf@/bin/patchelf") ++ .arg("--set-rpath") ++ .arg("@libPath@") ++ .arg(entry.path()) ++ .output(); ++ } ++ ++ Ok(()) ++} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-bisect-rustc/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-bisect-rustc/default.nix new file mode 100644 index 000000000000..7eef0ce66299 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-bisect-rustc/default.nix @@ -0,0 +1,56 @@ +{ stdenv +, lib +, fetchFromGitHub +, rustPlatform +, pkg-config +, openssl +, runCommand +, patchelf +, zlib +, Security +}: + +rustPlatform.buildRustPackage rec { + pname = "cargo-bisect-rustc"; + version = "0.6.0"; + + src = fetchFromGitHub { + owner = "rust-lang"; + repo = pname; + rev = "v${version}"; + hash = "sha256-LEmILWVU6hbh2FmdnQVV1Ob2MQvj+/lCr1hdRoTIOkI="; + }; + + patches = + let + patchelfPatch = runCommand "0001-dynamically-patchelf-binaries.patch" { + CC = stdenv.cc; + patchelf = patchelf; + libPath = "$ORIGIN/../lib:${lib.makeLibraryPath [ zlib ]}"; + } + '' + export dynamicLinker=$(cat $CC/nix-support/dynamic-linker) + substitute ${./0001-dynamically-patchelf-binaries.patch} $out \ + --subst-var patchelf \ + --subst-var dynamicLinker \ + --subst-var libPath + ''; + in + lib.optionals stdenv.isLinux [ patchelfPatch ]; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ + openssl + ] ++ lib.optionals stdenv.isDarwin [ + Security + ]; + + cargoSha256 = "Ls51DQ0yScRhpkuEInCfR45+/WeaUoG935w4BJvwSRk="; + + meta = with lib; { + description = "Bisects rustc, either nightlies or CI artifacts"; + homepage = "https://github.com/rust-lang/${pname}"; + license = with licenses; [ asl20 mit ]; + maintainers = with maintainers; [ davidtwco ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-bitbake/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-bitbake/default.nix new file mode 100644 index 000000000000..ee29976eb985 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-bitbake/default.nix @@ -0,0 +1,26 @@ +{ lib, pkg-config, rustPlatform, fetchFromGitHub, openssl }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-bitbake"; + version = "0.3.15"; + + src = fetchFromGitHub { + owner = "meta-rust"; + repo = pname; + rev = "v${version}"; + sha256 = "1ffjkwaqvmyz374azrv6gna19z2fcg82is2k2n2gm50isbxw2aa5"; + }; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ openssl ]; + + cargoSha256 = "0mm6059wjh5p8923dwz55dpwi55gq2bcmpx7kn40pq5ppkiqjiw9"; + + meta = with lib; { + description = "Cargo extension that can generate BitBake recipes utilizing the classes from meta-rust"; + homepage = "https://github.com/meta-rust/cargo-bitbake"; + license = with licenses; [ mit asl20 ]; + maintainers = with maintainers; [ rvarago ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-bloat/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-bloat/default.nix new file mode 100644 index 000000000000..549c3d11e3ac --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-bloat/default.nix @@ -0,0 +1,24 @@ +{ lib, rustPlatform, fetchFromGitHub }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-bloat"; + version = "0.10.1"; + + src = fetchFromGitHub { + owner = "RazrFalcon"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-VcdZ/dKqFFQs8ItNEj407z1pWJqpHwwIsuNnsQ8KU/8="; + }; + + cargoSha256 = "sha256-1TIGv0yVhkhThqZiQW9JrvFd0eouTlr8kgN/g7b4vDM="; + + meta = with lib; { + description = "A tool and Cargo subcommand that helps you find out what takes most of the space in your executable"; + homepage = "https://github.com/RazrFalcon/cargo-bloat"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = with maintainers; [ xrelkd ]; + }; +} + diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-c/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-c/default.nix new file mode 100644 index 000000000000..71394c098907 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-c/default.nix @@ -0,0 +1,50 @@ +{ rustPlatform, stdenv, lib, fetchFromGitHub, fetchurl +, pkg-config, openssl +, CoreFoundation, libiconv, Security +}: + +rustPlatform.buildRustPackage rec { + pname = "cargo-c"; + version = "0.8.1"; + + src = stdenv.mkDerivation rec { + name = "${pname}-source-${version}"; + + src = fetchFromGitHub { + owner = "lu-zero"; + repo = pname; + rev = "v${version}"; + sha256 = "0fd0xql5cbqgmir2z3ah91iasaq9133wmi5bnhiy3dv7drcqv4rc"; + }; + cargoLock = fetchurl { + url = "https://github.com/lu-zero/${pname}/releases/download/v${version}/Cargo.lock"; + sha256 = "1xlh3h77rxhqyr1nkqyanb120lwdks6fklh202camqpmznd763g5"; + }; + + installPhase = '' + mkdir -p $out + cp -R ./* $out/ + cp ${cargoLock} $out/Cargo.lock + ''; + }; + + cargoSha256 = "0b952xkg0l31laqlhsv3cqdag7v15k9na6xr6q9y8xwy1fjh9gzv"; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ openssl ] + ++ lib.optionals stdenv.isDarwin [ CoreFoundation libiconv Security ]; + + meta = with lib; { + description = "A cargo subcommand to build and install C-ABI compatibile dynamic and static libraries"; + longDescription = '' + Cargo C-ABI helpers. A cargo applet that produces and installs a correct + pkg-config file, a static library and a dynamic library, and a C header + to be used by any C (and C-compatible) software. + ''; + homepage = "https://github.com/lu-zero/cargo-c"; + changelog = "https://github.com/lu-zero/cargo-c/releases/tag/v${version}"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = with maintainers; [ ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-cache/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-cache/default.nix new file mode 100644 index 000000000000..12d9bd6bb036 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-cache/default.nix @@ -0,0 +1,26 @@ +{ lib, stdenv, fetchFromGitHub, rustPlatform, libiconv, Security }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-cache"; + version = "0.6.3"; + + src = fetchFromGitHub { + owner = "matthiaskrgr"; + repo = pname; + rev = version; + sha256 = "sha256-y6rvdY9511XScxLWPrH9aUFgSmRYmGqKE56MPBTH9OM="; + }; + + cargoSha256 = "sha256-H6MBAXrKu4hZwx3lGHN6YMuYzeb21Zq0tVlF/lsQmLI="; + + buildInputs = lib.optionals stdenv.isDarwin [ libiconv Security ]; + + checkFlagsArray = [ "offline_tests" ]; + + meta = with lib; { + description = "Manage cargo cache (\${CARGO_HOME}, ~/.cargo/), print sizes of dirs and remove dirs selectively"; + homepage = "https://github.com/matthiaskrgr/cargo-cache"; + license = with licenses; [ asl20 /* or */ mit ]; + maintainers = with maintainers; [ Br1ght0ne ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-crev/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-crev/default.nix new file mode 100644 index 000000000000..9803cd531e7e --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-crev/default.nix @@ -0,0 +1,45 @@ +{ lib, stdenv +, fetchFromGitHub +, rustPlatform +, perl +, pkg-config +, SystemConfiguration +, Security +, curl +, libiconv +, openssl +, git +}: + +rustPlatform.buildRustPackage rec { + pname = "cargo-crev"; + version = "0.20.1"; + + src = fetchFromGitHub { + owner = "crev-dev"; + repo = "cargo-crev"; + rev = version; + sha256 = "sha256-j2dafXUI6rDEYboSAciMeNma/YaBYKuQZgMUGVU+oBQ="; + }; + + cargoSha256 = "sha256-khrpS6QFpweKbTbR0YhAJTTrgDoZl9fzYPDs+JE1mtA="; + + preCheck = '' + export HOME=$(mktemp -d) + git config --global user.name "Nixpkgs Test" + git config --global user.email "nobody@example.com" + ''; + + nativeBuildInputs = [ perl pkg-config ]; + + buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ SystemConfiguration Security libiconv curl ]; + + checkInputs = [ git ]; + + meta = with lib; { + description = "A cryptographically verifiable code review system for the cargo (Rust) package manager"; + homepage = "https://github.com/crev-dev/cargo-crev"; + license = with licenses; [ asl20 mit mpl20 ]; + maintainers = with maintainers; [ b4dm4n ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-criterion/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-criterion/default.nix new file mode 100644 index 000000000000..d33f455c9b93 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-criterion/default.nix @@ -0,0 +1,22 @@ +{ lib, fetchFromGitHub, rustPlatform }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-criterion"; + version = "1.1.0"; + + src = fetchFromGitHub { + owner = "bheisler"; + repo = pname; + rev = version; + sha256 = "sha256-RPix9DM6E32PhObvV3xPGrnXrrVHn3auxLUhysP8GM0="; + }; + + cargoSha256 = "sha256-L/ILHKWlcYTkbEi2qDu7tf/3NHfTl6GhW0s+fUlsW08="; + + meta = with lib; { + description = "Cargo extension for running Criterion.rs benchmarks"; + homepage = "https://github.com/bheisler/cargo-criterion"; + license = with licenses; [ asl20 /* or */ mit ]; + maintainers = with maintainers; [ humancalico ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-cross/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-cross/default.nix new file mode 100644 index 000000000000..276d6e50eeed --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-cross/default.nix @@ -0,0 +1,40 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, fetchpatch +, nix-update-script +}: + +rustPlatform.buildRustPackage rec { + pname = "cargo-cross"; + version = "0.2.1"; + + src = fetchFromGitHub { + owner = "rust-embedded"; + repo = "cross"; + rev = "v${version}"; + sha256 = "sha256:1py5w4kf612x4qxi190ilsrx0zzwdzk9i47ppvqblska1s47qa2w"; + }; + + cargoSha256 = "sha256-zk6cbN4iSHnyoeWupufVf2yQK6aq3S99uk9lqpjCw4c="; + + cargoPatches = [ + (fetchpatch { + url = "https://github.com/rust-embedded/cross/commit/e86ad2e5a55218395df7eaaf91900e22b809083c.patch"; + sha256 = "sha256:1zrcj5fm3irmlrfkgb65kp2pjkry0rg5nn9pwsk9p0i6dpapjc7k"; + }) + ]; + + passthru = { + updateScript = nix-update-script { + attrPath = pname; + }; + }; + + meta = with lib; { + description = "Zero setup cross compilation and cross testing"; + homepage = "https://github.com/rust-embedded/cross"; + license = with licenses; [ asl20 /* or */ mit ]; + maintainers = with maintainers; [ otavio ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-deny/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-deny/default.nix new file mode 100644 index 000000000000..955df96b2284 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-deny/default.nix @@ -0,0 +1,36 @@ +{ stdenv +, lib +, rustPlatform +, fetchFromGitHub +, perl, pkg-config, openssl, Security, libiconv, curl +}: + +rustPlatform.buildRustPackage rec { + pname = "cargo-deny"; + version = "0.9.1"; + + src = fetchFromGitHub { + owner = "EmbarkStudios"; + repo = pname; + rev = version; + sha256 = "sha256-v7Gdemn0IeO6lOg/kT6VKuL5ZSOqA9A721Wv5QStO2Q="; + }; + + cargoSha256 = "sha256-SF7LfxmUMX7f+9BmYTzdjTFplXj5j0e181yRVTIEGH4="; + + doCheck = false; + + nativeBuildInputs = [ perl pkg-config ]; + + buildInputs = [ openssl ] + ++ lib.optionals stdenv.isDarwin [ Security libiconv curl ]; + + meta = with lib; { + description = "Cargo plugin to generate list of all licenses for a crate"; + homepage = "https://github.com/EmbarkStudios/cargo-deny"; + license = licenses.asl20; + platforms = platforms.unix; + maintainers = with maintainers; [ matthiasbeyer ]; + }; +} + diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-embed/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-embed/default.nix new file mode 100644 index 000000000000..2af012956c1a --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-embed/default.nix @@ -0,0 +1,36 @@ +{ lib +, stdenv +, rustPlatform +, fetchFromGitHub +, libusb1 +, libftdi1 +, pkg-config +, rustfmt +, AppKit +}: + +rustPlatform.buildRustPackage rec { + pname = "cargo-embed"; + version = "0.11.0"; + + src = fetchFromGitHub { + owner = "probe-rs"; + repo = pname; + rev = "v${version}"; + sha256 = "151zdnv4i0dgkk4w3j2a1sdklcxw07bgqjs7sv6lvkylrx8dfrxa"; + }; + + cargoSha256 = "00p2rwqrax99kwadc8bfq8pbcijals2nzpx43wb03kwxl4955wn9"; + + nativeBuildInputs = [ pkg-config rustfmt ]; + buildInputs = [ libusb1 libftdi1 ] ++ lib.optionals stdenv.isDarwin [ AppKit ]; + + cargoBuildFlags = [ "--features=ftdi" ]; + + meta = with lib; { + description = "A cargo extension for working with microcontrollers"; + homepage = "https://probe.rs/"; + license = with licenses; [ asl20 /* or */ mit ]; + maintainers = with maintainers; [ fooker ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-expand/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-expand/default.nix new file mode 100644 index 000000000000..304ede5214ab --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-expand/default.nix @@ -0,0 +1,25 @@ +{ lib, rustPlatform, fetchFromGitHub, stdenv, libiconv }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-expand"; + version = "1.0.9"; + + src = fetchFromGitHub { + owner = "dtolnay"; + repo = pname; + rev = version; + sha256 = "sha256-wDuCmiQzyY/Ydr67fYb0yZaSWvuYwW91j0CoqbUFFpg="; + }; + + cargoSha256 = "sha256-5KCGXJzk5VStby/JzjXJvDSrhFlB8YJHMcQNL8GxkLI="; + + buildInputs = lib.optional stdenv.isDarwin libiconv; + + meta = with lib; { + description = + "A utility and Cargo subcommand designed to let people expand macros in their Rust source code"; + homepage = "https://github.com/dtolnay/cargo-expand"; + license = with licenses; [ mit asl20 ]; + maintainers = with maintainers; [ xrelkd ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-feature/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-feature/default.nix new file mode 100644 index 000000000000..062cb9f027d6 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-feature/default.nix @@ -0,0 +1,26 @@ +{ lib, rustPlatform, fetchFromGitHub, stdenv, libiconv }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-feature"; + version = "0.5.2"; + + src = fetchFromGitHub { + owner = "Riey"; + repo = pname; + rev = "v${version}"; + sha256 = "0n5kzh756ghfs3cydlcn9mfvpgwy1cjg41h0nd9dbi5cr1fp9x1n"; + }; + + cargoSha256 = "1jh1h6v4mxx03b4diw9325ga0k3js0czs504lx07hvbx8yai1wkq"; + + buildInputs = lib.optional stdenv.isDarwin libiconv; + + meta = with lib; { + description = "Allows conveniently modify features of crate"; + homepage = "https://github.com/Riey/cargo-feature"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = with maintainers; [ riey ]; + }; +} + diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-flash/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-flash/default.nix new file mode 100644 index 000000000000..13339e4dc342 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-flash/default.nix @@ -0,0 +1,35 @@ +{ lib +, stdenv +, rustPlatform +, fetchFromGitHub +, libusb1 +, openssl +, pkg-config +, rustfmt +, Security +, AppKit +}: + +rustPlatform.buildRustPackage rec { + pname = "cargo-flash"; + version = "0.11.0"; + + src = fetchFromGitHub { + owner = "probe-rs"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-yTtnRdDy3wGBe0SlO0165uooWu6ZMhUQw3hdDUK1e8A="; + }; + + cargoSha256 = "sha256-f5vUMdyz3vDh2yE0pMKZiknsqTAKkuvTCtlgb6/gaLc="; + + nativeBuildInputs = [ pkg-config rustfmt ]; + buildInputs = [ libusb1 openssl ] ++ lib.optionals stdenv.isDarwin [ Security AppKit ]; + + meta = with lib; { + description = "A cargo extension for working with microcontrollers"; + homepage = "https://probe.rs/"; + license = with licenses; [ asl20 /* or */ mit ]; + maintainers = with maintainers; [ fooker ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-fund/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-fund/default.nix new file mode 100644 index 000000000000..43655fd6a89e --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-fund/default.nix @@ -0,0 +1,29 @@ +{ lib, stdenv, fetchFromGitHub, pkg-config, rustPlatform, Security, curl, openssl, libiconv }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-fund"; + version = "0.2.0"; + + src = fetchFromGitHub { + owner = "acfoltzer"; + repo = pname; + rev = version; + sha256 = "1jim5bgq3fc33391qpa1q1csbzqf4hk1qyfzwxpcs5pb4ixb6vgk"; + }; + + cargoSha256 = "1c2zryxn1bbg3ksp8azk9xmwfgwr6663hlmdv9c358hzqdfp9hli"; + + # The tests need a GitHub API token. + doCheck = false; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security libiconv curl ]; + + meta = with lib; { + description = "Discover funding links for your project's dependencies"; + homepage = "https://github.com/acfoltzer/cargo-fund"; + license = with licenses; [ mit /* or */ asl20 ]; + maintainers = with maintainers; [ johntitor ]; + }; +} 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..56a2962f0c92 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-fuzz/default.nix @@ -0,0 +1,26 @@ +{ lib, fetchFromGitHub, rustPlatform, stdenv, libiconv }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-fuzz"; + version = "0.10.1"; + + src = fetchFromGitHub { + owner = "rust-fuzz"; + repo = "cargo-fuzz"; + rev = version; + sha256 = "sha256-txlHXboQi3Z8AMIJJBZsBrCA7xggF0zGDpKqcD8UxMo="; + }; + + cargoSha256 = "sha256-eEfry6Q2YiIkNEHu6C8p17pUTF43eS1/iTP2oATZ/F8="; + + buildInputs = lib.optional stdenv.isDarwin libiconv; + + doCheck = false; + + meta = with lib; { + description = "Command line helpers for fuzzing"; + homepage = "https://github.com/rust-fuzz/cargo-fuzz"; + license = with licenses; [ mit asl20 ]; + maintainers = [ maintainers.ekleog ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-geiger/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-geiger/default.nix new file mode 100644 index 000000000000..bd71a14b4a04 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-geiger/default.nix @@ -0,0 +1,42 @@ +{ stdenv, lib, fetchFromGitHub +, rustPlatform, pkg-config, openssl +# testing packages +, cargo-insta +# darwin dependencies +, Security, CoreFoundation, libiconv +}: + +rustPlatform.buildRustPackage rec { + pname = "cargo-geiger"; + version = "0.10.2"; + + src = fetchFromGitHub { + owner = "rust-secure-code"; + repo = pname; + rev = "${pname}-${version}"; + sha256 = "1z920p8i3gkjadyd6bqjk4i5yr5ds3m3sbcnf7plcqr69dsjr4b8"; + }; + + cargoSha256 = "1wf9758gyaxgyajjzy5phirg922n9wv0qmy67zjmxj56ayf0l9lm"; + + checkPhase = '' + ${cargo-insta}/bin/cargo-insta test + ''; + + buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security libiconv ]; + nativeBuildInputs = [ pkg-config ]; + + # FIXME: Use impure version of CoreFoundation because of missing symbols. + # CFURLSetResourcePropertyForKey is defined in the headers but there's no + # corresponding implementation in the sources from opensource.apple.com. + preConfigure = lib.optionalString stdenv.isDarwin '' + export NIX_CFLAGS_COMPILE="-F${CoreFoundation}/Library/Frameworks $NIX_CFLAGS_COMPILE" + ''; + + meta = with lib; { + description = "Detects usage of unsafe Rust in a Rust crate and its dependencies"; + homepage = "https://github.com/rust-secure-code/cargo-geiger"; + license = with licenses; [ asl20 /* or */ mit ]; + maintainers = with maintainers; [ evanjs ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-geiger/update-cargo-lock.sh b/nixpkgs/pkgs/development/tools/rust/cargo-geiger/update-cargo-lock.sh new file mode 100755 index 000000000000..6e077c6733f3 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-geiger/update-cargo-lock.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# This updates cargo-lock.patch for the diesel version listed in default.nix. + +set -eu -o verbose + +here=$PWD +version=$(cat default.nix | grep '^ version = "' | cut -d '"' -f 2) +checkout=$(mktemp -d) +git clone -b "cargo-geiger-$version" --depth=1 https://github.com/rust-secure-code/cargo-geiger "$checkout" +cd "$checkout" + +rm -f rust-toolchain +cargo generate-lockfile +git add -f Cargo.lock +git diff HEAD -- Cargo.lock > "$here"/cargo-lock.patch + +cd "$here" +rm -rf "$checkout" diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-generate/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-generate/default.nix new file mode 100644 index 000000000000..040109da3adb --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-generate/default.nix @@ -0,0 +1,33 @@ +{ lib, stdenv, fetchFromGitHub, rustPlatform, Security, openssl, pkg-config, libiconv, curl }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-generate"; + version = "0.5.3"; + + src = fetchFromGitHub { + owner = "ashleygwilliams"; + repo = "cargo-generate"; + rev = "v${version}"; + sha256 = "sha256-RrDwq5VufMDsPlqRmBP3x2RUWU740L0L18noByO1IDY="; + }; + + cargoSha256 = "sha256-/0pxEQFhovPRI4Knv5xq6+PHRuGN6+tF8CdK5X30LKI="; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ openssl ] + ++ lib.optionals stdenv.isDarwin [ Security libiconv curl ]; + + preCheck = '' + export HOME=$(mktemp -d) USER=nixbld + git config --global user.name Nixbld + git config --global user.email nixbld@localhost.localnet + ''; + + meta = with lib; { + description = "cargo, make me a project"; + homepage = "https://github.com/ashleygwilliams/cargo-generate"; + license = licenses.asl20; + maintainers = [ maintainers.turbomack ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-inspect/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-inspect/default.nix new file mode 100644 index 000000000000..1644929074bb --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-inspect/default.nix @@ -0,0 +1,24 @@ +{ stdenv, lib, rustPlatform, fetchFromGitHub, Security }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-inspect"; + version = "0.10.3"; + + src = fetchFromGitHub { + owner = "mre"; + repo = pname; + rev = version; + sha256 = "026vc8d0jkc1d7dlp3ldmwks7svpvqzl0k5niri8a12cl5w5b9hj"; + }; + + buildInputs = lib.optionals stdenv.isDarwin [ Security ]; + + cargoSha256 = "069i8ydrp1pssnjq7d6mydwr7xh2cmcpzpf8bzd6nfjr6xx1pipr"; + + meta = with lib; { + description = "See what Rust is doing behind the curtains"; + homepage = "https://github.com/mre/cargo-inspect"; + license = with licenses; [ mit asl20 ]; + maintainers = with maintainers; [ minijackson ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-insta/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-insta/default.nix new file mode 100644 index 000000000000..0c3773933545 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-insta/default.nix @@ -0,0 +1,24 @@ +{ lib, rustPlatform, fetchFromGitHub, libiconv, stdenv }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-insta"; + version = "1.7.1"; + + src = fetchFromGitHub { + owner = "mitsuhiko"; + repo = "insta"; + rev = version; + sha256 = "1qzzkhailxjqwp3rmdcpp112wn3x0gfi788vwj77pfdyclhpj0a7"; + }; + + sourceRoot = "source/cargo-insta"; + cargoSha256 = "01fj2j7ibrk5dyrfkmc610lh1p6f6bgzbgivq3dsd64vslhqmabw"; + buildInputs = lib.optionals stdenv.isDarwin [ libiconv ]; + + meta = with lib; { + description = "A Cargo subcommand for snapshot testing"; + homepage = "https://github.com/mitsuhiko/insta"; + license = licenses.asl20; + maintainers = with lib.maintainers; [ oxalica ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-limit/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-limit/default.nix new file mode 100644 index 000000000000..76f766685ab4 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-limit/default.nix @@ -0,0 +1,36 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, nix-update-script +, stdenv +, libiconv +}: + +rustPlatform.buildRustPackage rec { + pname = "cargo-limit"; + version = "0.0.8"; + + src = fetchFromGitHub { + owner = "alopatindev"; + repo = "cargo-limit"; + rev = version; + sha256 = "sha256-OHBxQcXhZkJ1F6xLc7/sPpJhJzuJXb91IUjAtyC3XP8="; + }; + + cargoSha256 = "sha256-LxqxRtMKUKZeuvk1caoYy8rv1bkEOQBM8i5SXMF4GXc="; + + buildInputs = lib.optionals stdenv.isDarwin [ libiconv ]; + + passthru = { + updateScript = nix-update-script { + attrPath = pname; + }; + }; + + meta = with lib; { + description = "Cargo subcommand \"limit\": reduces the noise of compiler messages"; + homepage = "https://github.com/alopatindev/cargo-limit"; + license = with licenses; [ asl20 /* or */ mit ]; + maintainers = with maintainers; [ otavio ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-make/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-make/default.nix new file mode 100644 index 000000000000..01173474db6f --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-make/default.nix @@ -0,0 +1,42 @@ +{ lib +, stdenv +, fetchurl +, runCommand +, fetchCrate +, rustPlatform +, Security +, openssl +, pkg-config +, SystemConfiguration +, libiconv +}: + +rustPlatform.buildRustPackage rec { + pname = "cargo-make"; + version = "0.35.0"; + + src = fetchCrate { + inherit pname version; + sha256 = "sha256-pC3iX5jAPBArxs+YECDyUW5+MP+/f2HMLZNjo+BoKOE="; + }; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ openssl ] + ++ lib.optionals stdenv.isDarwin [ Security SystemConfiguration libiconv ]; + + cargoSha256 = "sha256-Zp2LoeCnpYupi/QY3Ft1VQ+O/y3I96UaouEFs9QpbLg="; + + # Some tests fail because they need network access. + # However, Travis ensures a proper build. + # See also: + # https://travis-ci.org/sagiegurari/cargo-make + doCheck = false; + + meta = with lib; { + description = "A Rust task runner and build tool"; + homepage = "https://github.com/sagiegurari/cargo-make"; + license = licenses.asl20; + maintainers = with maintainers; [ xrelkd ma27 ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-modules/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-modules/default.nix new file mode 100644 index 000000000000..f894915c24ec --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-modules/default.nix @@ -0,0 +1,22 @@ +{ lib, rustPlatform, fetchFromGitHub }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-modules"; + version = "0.5.0"; + + src = fetchFromGitHub { + owner = "regexident"; + repo = pname; + rev = version; + sha256 = "0y6ag8nar85l2fh2ca41fglkzc74cv1p5szxrhk1jdqnd2qzhvjp"; + }; + + cargoSha256 = "0m5r36p57w4vw2g3hg12s38ay328swjb0qfl381xwb2xqx10g8kx"; + + meta = with lib; { + description = "A cargo plugin for showing a tree-like overview of a crate's modules"; + homepage = "https://github.com/regexident/cargo-modules"; + license = with licenses; [ mpl20 ]; + maintainers = with maintainers; [ rvarago ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-msrv/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-msrv/default.nix new file mode 100644 index 000000000000..96720a549a90 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-msrv/default.nix @@ -0,0 +1,46 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, nix-update-script +, pkg-config +, openssl +, stdenv +, libiconv +, Security +}: + +rustPlatform.buildRustPackage rec { + pname = "cargo-msrv"; + version = "0.9.0"; + + src = fetchFromGitHub { + owner = "foresterre"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-QN9N3o6gnr/pUTvRHxl3Wv42KxFOlRDpIr5pw2vB1x4="; + }; + + cargoSha256 = "sha256-rgiOwkbQLnaREvd5yMmipnVnl5Lqb+g+SHeP0V8XVTQ="; + + passthru = { + updateScript = nix-update-script { + attrPath = pname; + }; + }; + + # Integration tests fail + doCheck = false; + + buildInputs = if stdenv.isDarwin + then [ libiconv Security ] + else [ openssl ]; + + nativeBuildInputs = [ pkg-config ]; + + meta = with lib; { + description = "Cargo subcommand \"msrv\": assists with finding your minimum supported Rust version (MSRV)"; + homepage = "https://github.com/foresterre/cargo-msrv"; + license = with licenses; [ asl20 /* or */ mit ]; + maintainers = with maintainers; [ otavio ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-play/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-play/default.nix new file mode 100644 index 000000000000..f5faed06faf9 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-play/default.nix @@ -0,0 +1,25 @@ +{ fetchFromGitHub, lib, rustPlatform }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-play"; + version = "0.5.0"; + + src = fetchFromGitHub { + owner = "fanzeyi"; + repo = pname; + rev = "v${version}"; + sha256 = "01r00akfmvpzp924yqqybd9s0pwiwxy8vklsg4m9ypzljc3nlv02"; + }; + + cargoSha256 = "1xkscd9ci9vlkmbsaxvavrna1xpi16xcf9ri879lw8bdh7sa3nx8"; + + # some tests require internet access + doCheck = false; + + meta = with lib; { + description = "Run your rust code without setting up cargo"; + homepage = "https://github.com/fanzeyi/cargo-play"; + license = licenses.mit; + maintainers = with maintainers; [ figsoda ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-raze/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-raze/default.nix new file mode 100644 index 000000000000..0299fe516d94 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-raze/default.nix @@ -0,0 +1,32 @@ +{ lib, stdenv, fetchFromGitHub, rustPlatform +, pkg-config, curl, libgit2, openssl, Security }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-raze"; + version = "0.12.0"; + + src = fetchFromGitHub { + owner = "google"; + repo = pname; + rev = "v${version}"; + sha256 = "161m4y6i4sgqi9mg3f3348f5cr0m45vhix4a4bcw54wnmhiklnnl"; + }; + sourceRoot = "source/impl"; + + cargoSha256 = "1vlywdq0bx6b1k3w1grisca0hvv2s4s88yxq7bil8nhm5ghjgxdr"; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ curl libgit2 openssl ] + ++ lib.optional stdenv.isDarwin Security; + + # thread 'main' panicked at 'Cannot ping mock server.: "cannot send request to mock server: cannot send request to mock server: failed to resolve host name"' + # __darwinAllowLocalNetworking does not fix the panic + doCheck = !stdenv.isDarwin; + + meta = with lib; { + description = "Generate Bazel BUILD files from Cargo dependencies"; + homepage = "https://github.com/google/cargo-raze"; + license = licenses.asl20; + maintainers = with maintainers; [ elasticdog ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-readme/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-readme/default.nix new file mode 100644 index 000000000000..fb45763b50be --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-readme/default.nix @@ -0,0 +1,34 @@ +{ lib, rustPlatform, fetchFromGitHub, fetchpatch }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-readme"; + version = "3.2.0"; + + src = fetchFromGitHub { + owner = "livioribeiro"; + repo = pname; + # Git tag is missing, see upstream issue: + # https://github.com/livioribeiro/cargo-readme/issues/61 + rev = "cf66017c0120ae198210ebaf58a0be6a78372974"; + sha256 = "sha256-/ufHHM13L83M3UYi6mjdhIjgXx7bZgzvR/X02Zsx7Fw="; + }; + + cargoSha256 = "sha256-Isd05qOuVBNfXOI5qsaDOhjF7QIKAG5xrZsBFK2PpQQ="; + + patches = [ + (fetchpatch { + # Fixup warning thrown at build when running test-suite + # unused return, see upstream PR: + # https://github.com/livioribeiro/cargo-readme/pull/62 + url = "https://github.com/livioribeiro/cargo-readme/commit/060f2daaa2b2cf981bf490dc36bcc6527545ea03.patch"; + sha256 = "sha256-wlAIgTI9OqtA/Jnswoqp7iOj+1zjrUZA7JpHUiF/n+s="; + }) + ]; + + meta = with lib; { + description = "Generate README.md from docstrings"; + homepage = "https://github.com/livioribeiro/cargo-readme"; + license = with licenses; [ mit asl20 ]; + maintainers = with maintainers; [ baloo ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-rr/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-rr/default.nix new file mode 100644 index 000000000000..47d58e9b92ac --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-rr/default.nix @@ -0,0 +1,40 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, nix-update-script +, makeWrapper +, rr +}: + +rustPlatform.buildRustPackage rec { + pname = "cargo-rr"; + version = "0.1.3"; + + src = fetchFromGitHub { + owner = "danielzfranklin"; + repo = pname; + rev = version; + sha256 = "01m8fdz9as2fxnzs9csvbc76qxzbb98a66dh7w4a5q855v38g0zy"; + }; + + cargoSha256 = "0fjs76n6bbbv83s213h2dgsszgxy4hbjsclyk9m81b3bfbmmb9sa"; + + passthru = { + updateScript = nix-update-script { + attrPath = pname; + }; + }; + + nativeBuildInputs = [ makeWrapper ]; + + postInstall = '' + wrapProgram $out/bin/cargo-rr --prefix PATH : ${lib.makeBinPath [ rr ]} + ''; + + meta = with lib; { + description = "Cargo subcommand \"rr\": a light wrapper around rr, the time-travelling debugger"; + homepage = "https://github.com/danielzfranklin/cargo-rr"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ otavio ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-sort/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-sort/default.nix new file mode 100644 index 000000000000..9ab6d7e2b03a --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-sort/default.nix @@ -0,0 +1,22 @@ +{ fetchFromGitHub, lib, rustPlatform }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-sort"; + version = "1.0.5"; + + src = fetchFromGitHub { + owner = "devinr528"; + repo = pname; + rev = "v${version}"; + sha256 = "146aawikyjcxbj0dpnqia31xmplpwkl9w1gv7d9a5jvz8whvxrff"; + }; + + cargoSha256 = "0xm37f285vmd674k5j72pcjg6zpmxlf46d9vppi9s3qaw0hsslpf"; + + meta = with lib; { + description = "A tool to check that your Cargo.toml dependencies are sorted alphabetically"; + homepage = "https://github.com/devinr528/cargo-sort"; + license = with licenses; [ mit /* or */ asl20 ]; + maintainers = with maintainers; [ figsoda ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-sweep/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-sweep/default.nix new file mode 100644 index 000000000000..9efa337f1b19 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-sweep/default.nix @@ -0,0 +1,22 @@ +{ lib, rustPlatform, fetchFromGitHub }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-sweep"; + version = "0.6.2"; + + src = fetchFromGitHub { + owner = "holmgr"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-tumcGnYqY/FGP8UWA0ccfdAK49LBcT8qH6SshrDXNAI="; + }; + + cargoSha256 = "sha256-fcosKyGOy0SKrHbsKdxQJimelt1ByAM4YKo7WpHV8CA="; + + meta = with lib; { + description = "A Cargo subcommand for cleaning up unused build files generated by Cargo"; + homepage = "https://github.com/holmgr/cargo-sweep"; + license = licenses.mit; + maintainers = with maintainers; [ xrelkd ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-sync-readme/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-sync-readme/default.nix new file mode 100644 index 000000000000..07c51c3163cb --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-sync-readme/default.nix @@ -0,0 +1,22 @@ +{ lib, rustPlatform, fetchFromGitHub }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-sync-readme"; + version = "1.0"; + + src = fetchFromGitHub { + owner = "phaazon"; + repo = pname; + rev = version; + sha256 = "1c38q87fyfmj6nlwdpavb1xxpi26ncywkgqcwbvblad15c6ydcyc"; + }; + + cargoSha256 = "0vrbgs49ghhl4z4ljhghcs9fnbf7qx1an9kwbrgv9wng8m1dccah"; + + meta = with lib; { + description = "A cargo plugin that generates a Markdown section in your README based on your Rust documentation"; + homepage = "https://github.com/phaazon/cargo-sync-readme"; + license = licenses.bsd3; + maintainers = with maintainers; [ b4dm4n ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-udeps/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-udeps/default.nix new file mode 100644 index 000000000000..0a76ae0202c4 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-udeps/default.nix @@ -0,0 +1,31 @@ +{ lib, stdenv, rustPlatform, fetchFromGitHub, pkg-config, openssl, CoreServices, Security, libiconv, SystemConfiguration }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-udeps"; + version = "0.1.22"; + + src = fetchFromGitHub { + owner = "est31"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-z92q0uwL832Ph7sTpWpaa8e9Xrik9wnjQ7LBy/hY8KE="; + }; + + cargoSha256 = "sha256-4HguNyPIjpFqa80dDVFgXDK7pHOuFJdpFNxLARXxT2g="; + + nativeBuildInputs = [ pkg-config ]; + + # TODO figure out how to use provided curl instead of compiling curl from curl-sys + buildInputs = [ openssl ] + ++ lib.optionals stdenv.isDarwin [ CoreServices Security libiconv SystemConfiguration ]; + + # Requires network access + doCheck = false; + + meta = with lib; { + description = "Find unused dependencies in Cargo.toml"; + homepage = "https://github.com/est31/cargo-udeps"; + license = licenses.mit; + maintainers = with maintainers; [ b4dm4n ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-valgrind/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-valgrind/default.nix new file mode 100644 index 000000000000..e1f26dc02b2e --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-valgrind/default.nix @@ -0,0 +1,43 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, nix-update-script +, makeWrapper +, valgrind +}: + +rustPlatform.buildRustPackage rec { + pname = "cargo-valgrind"; + version = "2.0.1"; + + src = fetchFromGitHub { + owner = "jfrimmel"; + repo = "cargo-valgrind"; + rev = version; + sha256 = "sha256-PltYUU2O/D1PrU+K8JN4+aUVLzHCeNyIsXMU6HLodXE="; + }; + + cargoSha256 = "sha256-XiQGkZ6pfyGkNPjpcPoY66qBl7ABTcRHCBjgmXSRrL0="; + + passthru = { + updateScript = nix-update-script { + attrPath = pname; + }; + }; + + nativeBuildInputs = [ makeWrapper ]; + + postInstall = '' + wrapProgram $out/bin/cargo-valgrind --prefix PATH : ${lib.makeBinPath [ valgrind ]} + ''; + + # Disable check phase as there are failures (2 tests fail) + doCheck = false; + + meta = with lib; { + description = ''Cargo subcommand "valgrind": runs valgrind and collects its output in a helpful manner''; + homepage = "https://github.com/jfrimmel/cargo-valgrind"; + license = with licenses; [ asl20 /* or */ mit ]; + maintainers = with maintainers; [ otavio ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-watch/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-watch/default.nix new file mode 100644 index 000000000000..46bd0a591a04 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-watch/default.nix @@ -0,0 +1,30 @@ +{ stdenv, lib, rustPlatform, fetchFromGitHub, CoreServices, Foundation, rust, libiconv }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-watch"; + version = "8.0.0"; + + src = fetchFromGitHub { + owner = "passcod"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-3IgzMUCkcKUkhTb/ZNRONdvB6Ci0OBB1dcjtc65U8xE="; + }; + + cargoSha256 = "sha256-Xp/pxPKs41TXO/EUY5x8Bha7NUioMabbb73///fFr6U="; + + buildInputs = lib.optionals stdenv.isDarwin [ CoreServices Foundation libiconv ]; + + # `test with_cargo` tries to call cargo-watch as a cargo subcommand + # (calling cargo-watch with command `cargo watch`) + preCheck = '' + export PATH="$(pwd)/target/${rust.toRustTarget stdenv.hostPlatform}/release:$PATH" + ''; + + meta = with lib; { + description = "A Cargo subcommand for watching over Cargo project's source"; + homepage = "https://github.com/passcod/cargo-watch"; + license = licenses.cc0; + maintainers = with maintainers; [ xrelkd ivan ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-whatfeatures/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-whatfeatures/default.nix new file mode 100644 index 000000000000..7041f0ebd6cd --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-whatfeatures/default.nix @@ -0,0 +1,27 @@ +{ lib, stdenv, fetchFromGitHub, rustPlatform, pkg-config, openssl, Security }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-whatfeatures"; + version = "0.9.6"; + + src = fetchFromGitHub { + owner = "museun"; + repo = pname; + rev = "v${version}"; + sha256 = "0vki37pxngg15za9c1z61dc6sqk0j59s0qhcf9hplnym4ib5kqx1"; + }; + + cargoSha256 = "sha256-ZEkSj/JzXXTHjaxBVS5RDk/ECvOPPjzH4eS3CmlQA9I="; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ openssl ] + ++ lib.optionals stdenv.isDarwin [ Security ]; + + meta = with lib; { + description = "A simple cargo plugin to get a list of features for a specific crate"; + homepage = "https://github.com/museun/cargo-whatfeatures"; + license = with licenses; [ mit asl20 ]; + maintainers = with maintainers; [ ivan-babrou ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-wipe/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-wipe/default.nix new file mode 100644 index 000000000000..a59a124317b9 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-wipe/default.nix @@ -0,0 +1,32 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, nix-update-script +}: + +rustPlatform.buildRustPackage rec { + pname = "cargo-wipe"; + version = "0.3.1"; + + src = fetchFromGitHub { + owner = "mihai-dinculescu"; + repo = "cargo-wipe"; + rev = "v${version}"; + sha256 = "sha256-sVekfGHg2wspP5/zJzXTXupspwJr4hQBucY5+8iUjUQ="; + }; + + cargoSha256 = "sha256-EoXgsWg1Rh7C+fIqvefkLdck4Yj3kox2ZAU3kn6nH8Q="; + + passthru = { + updateScript = nix-update-script { + attrPath = pname; + }; + }; + + meta = with lib; { + description = ''Cargo subcommand "wipe": recursively finds and optionally wipes all "target" or "node_modules" folders''; + homepage = "https://github.com/mihai-dinculescu/cargo-wipe"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ otavio ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/cargo-xbuild/default.nix b/nixpkgs/pkgs/development/tools/rust/cargo-xbuild/default.nix new file mode 100644 index 000000000000..e8d62c9252f3 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cargo-xbuild/default.nix @@ -0,0 +1,22 @@ +{ lib, fetchFromGitHub, rustPlatform }: + +rustPlatform.buildRustPackage rec { + pname = "cargo-xbuild"; + version = "0.6.2"; + + src = fetchFromGitHub { + owner = "rust-osdev"; + repo = pname; + rev = "v${version}"; + sha256 = "01whdjryz6zjsk4149h72w5xdjnkpcn5daf0xnsb59b0q38hjgg9"; + }; + + cargoSha256 = "036a50shzl6wdjk5wypkacx1kjwbyb4x1aqhbzgjgpxxxrf0lj16"; + + meta = with lib; { + description = "Automatically cross-compiles the sysroot crates core, compiler_builtins, and alloc"; + homepage = "https://github.com/rust-osdev/cargo-xbuild"; + license = with licenses; [ mit asl20 ]; + maintainers = with maintainers; [ johntitor xrelkd ]; + }; +} 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..c1bc2fb4c07b --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/cbindgen/default.nix @@ -0,0 +1,38 @@ +{ lib, stdenv, fetchFromGitHub, rustPlatform, python3Packages, Security }: + +rustPlatform.buildRustPackage rec { + pname = "rust-cbindgen"; + version = "0.19.0"; + + src = fetchFromGitHub { + owner = "eqrion"; + repo = "cbindgen"; + rev = "v${version}"; + sha256 = "0753dklr5lm1dmk6hy5khh8k3xyr5srfsq11l07685h71j7z0r00"; + }; + + cargoSha256 = "0qyw0iqin7i31kk23ddsmywk7z0xxpd5n4q6dr6mf44y35a8krm8"; + + buildInputs = lib.optional stdenv.isDarwin Security; + + checkInputs = [ + python3Packages.cython + ]; + + checkFlags = [ + # Disable tests that require rust unstable features + # https://github.com/eqrion/cbindgen/issues/338 + "--skip test_expand" + "--skip test_bitfield" + "--skip lib_default_uses_debug_build" + "--skip lib_explicit_debug_build" + "--skip lib_explicit_release_build" + ]; + + meta = with 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/crate2nix/default.nix b/nixpkgs/pkgs/development/tools/rust/crate2nix/default.nix new file mode 100644 index 000000000000..a86e531e7f67 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/crate2nix/default.nix @@ -0,0 +1,48 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, makeWrapper + +, cargo +, nix +, nix-prefetch-git +}: + +rustPlatform.buildRustPackage rec { + pname = "crate2nix"; + version = "0.10.0"; + + src = fetchFromGitHub { + owner = "kolloch"; + repo = pname; + rev = version; + sha256 = "sha256-JaF9/H3m4Wrc5MtXcONkOAgKVkswLVw0yZe0dBr2e4Y="; + }; + + sourceRoot = "source/crate2nix"; + + cargoSha256 = "sha256-PD7R1vcb3FKd4hfpViKyvfCExJ5H1Xo2HPYden5zpxQ="; + + nativeBuildInputs = [ makeWrapper ]; + + # Tests use nix(1), which tries (and fails) to set up /nix/var inside the + # sandbox + doCheck = false; + + postFixup = '' + wrapProgram $out/bin/crate2nix \ + --suffix PATH ":" ${lib.makeBinPath [ cargo nix nix-prefetch-git ]} + ''; + + meta = with lib; { + description = "A Nix build file generator for Rust crates."; + longDescription = '' + Crate2nix generates Nix files from Cargo.toml/lock files + so that you can build every crate individually in a Nix sandbox. + ''; + homepage = "https://github.com/kolloch/crate2nix"; + license = licenses.asl20; + maintainers = with maintainers; [ kolloch andir cole-h ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/maturin/default.nix b/nixpkgs/pkgs/development/tools/rust/maturin/default.nix new file mode 100644 index 000000000000..deb68d7d00b8 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/maturin/default.nix @@ -0,0 +1,49 @@ +{ callPackage +, lib +, stdenv +, fetchFromGitHub +, rustPlatform +, pkg-config +, dbus +, libiconv +, Security +}: + +rustPlatform.buildRustPackage rec { + pname = "maturin"; + version = "0.10.6"; + + src = fetchFromGitHub { + owner = "PyO3"; + repo = "maturin"; + rev = "v${version}"; + hash = "sha256-qWDrdS1zxe5woQSKLHhDSGJ1KF4SHk1mhaQApJXCCO4="; + }; + + cargoHash = "sha256-NEXgb7yWQkqbbofd3oYQ5n+CmfaM2cWj8HwufrcRKkc="; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = lib.optionals stdenv.isLinux [ dbus ] + ++ lib.optionals stdenv.isDarwin [ Security libiconv ]; + + # Requires network access, fails in sandbox. + doCheck = false; + + passthru.tests.pyo3 = callPackage ./pyo3-test {}; + + meta = with lib; { + description = "Build and publish Rust crates Python packages"; + longDescription = '' + Build and publish Rust crates with PyO3, rust-cpython, and + cffi bindings as well as Rust binaries as Python packages. + + This project is meant as a zero-configuration replacement for + setuptools-rust and Milksnake. It supports building wheels for + Python and can upload them to PyPI. + ''; + homepage = "https://github.com/PyO3/maturin"; + license = licenses.asl20; + maintainers = [ ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/maturin/pyo3-test/Cargo.lock.patch b/nixpkgs/pkgs/development/tools/rust/maturin/pyo3-test/Cargo.lock.patch new file mode 100644 index 000000000000..3aca2e4803a9 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/maturin/pyo3-test/Cargo.lock.patch @@ -0,0 +1,688 @@ +diff --git a/Cargo.lock b/Cargo.lock +new file mode 100644 +index 000000000..5e698d4ff +--- /dev/null ++++ b/Cargo.lock +@@ -0,0 +1,682 @@ ++# This file is automatically @generated by Cargo. ++# It is not intended for manual editing. ++[[package]] ++name = "ahash" ++version = "0.4.7" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" ++ ++[[package]] ++name = "assert_approx_eq" ++version = "1.1.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "3c07dab4369547dbe5114677b33fbbf724971019f3818172d59a97a61c774ffd" ++ ++[[package]] ++name = "autocfg" ++version = "1.0.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" ++ ++[[package]] ++name = "bitflags" ++version = "1.2.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" ++ ++[[package]] ++name = "byteorder" ++version = "1.4.2" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" ++ ++[[package]] ++name = "cfg-if" ++version = "1.0.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" ++ ++[[package]] ++name = "const_fn" ++version = "0.4.5" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6" ++ ++[[package]] ++name = "crossbeam-channel" ++version = "0.5.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" ++dependencies = [ ++ "cfg-if", ++ "crossbeam-utils", ++] ++ ++[[package]] ++name = "crossbeam-deque" ++version = "0.8.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" ++dependencies = [ ++ "cfg-if", ++ "crossbeam-epoch", ++ "crossbeam-utils", ++] ++ ++[[package]] ++name = "crossbeam-epoch" ++version = "0.9.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d" ++dependencies = [ ++ "cfg-if", ++ "const_fn", ++ "crossbeam-utils", ++ "lazy_static", ++ "memoffset", ++ "scopeguard", ++] ++ ++[[package]] ++name = "crossbeam-utils" ++version = "0.8.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d" ++dependencies = [ ++ "autocfg", ++ "cfg-if", ++ "lazy_static", ++] ++ ++[[package]] ++name = "ctor" ++version = "0.1.19" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "e8f45d9ad417bcef4817d614a501ab55cdd96a6fdb24f49aab89a54acfd66b19" ++dependencies = [ ++ "quote", ++ "syn", ++] ++ ++[[package]] ++name = "either" ++version = "1.6.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" ++ ++[[package]] ++name = "getrandom" ++version = "0.1.16" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" ++dependencies = [ ++ "cfg-if", ++ "libc", ++ "wasi", ++] ++ ++[[package]] ++name = "ghost" ++version = "0.1.2" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "1a5bcf1bbeab73aa4cf2fde60a846858dc036163c7c33bec309f8d17de785479" ++dependencies = [ ++ "proc-macro2", ++ "quote", ++ "syn", ++] ++ ++[[package]] ++name = "glob" ++version = "0.3.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" ++ ++[[package]] ++name = "hashbrown" ++version = "0.9.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" ++dependencies = [ ++ "ahash", ++] ++ ++[[package]] ++name = "hermit-abi" ++version = "0.1.18" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" ++dependencies = [ ++ "libc", ++] ++ ++[[package]] ++name = "indoc" ++version = "0.3.6" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "47741a8bc60fb26eb8d6e0238bbb26d8575ff623fdc97b1a2c00c050b9684ed8" ++dependencies = [ ++ "indoc-impl", ++ "proc-macro-hack", ++] ++ ++[[package]] ++name = "indoc-impl" ++version = "0.3.6" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "ce046d161f000fffde5f432a0d034d0341dc152643b2598ed5bfce44c4f3a8f0" ++dependencies = [ ++ "proc-macro-hack", ++ "proc-macro2", ++ "quote", ++ "syn", ++ "unindent", ++] ++ ++[[package]] ++name = "instant" ++version = "0.1.9" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" ++dependencies = [ ++ "cfg-if", ++] ++ ++[[package]] ++name = "inventory" ++version = "0.1.10" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "0f0f7efb804ec95e33db9ad49e4252f049e37e8b0a4652e3cd61f7999f2eff7f" ++dependencies = [ ++ "ctor", ++ "ghost", ++ "inventory-impl", ++] ++ ++[[package]] ++name = "inventory-impl" ++version = "0.1.10" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "75c094e94816723ab936484666968f5b58060492e880f3c8d00489a1e244fa51" ++dependencies = [ ++ "proc-macro2", ++ "quote", ++ "syn", ++] ++ ++[[package]] ++name = "itoa" ++version = "0.4.7" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" ++ ++[[package]] ++name = "lazy_static" ++version = "1.4.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" ++ ++[[package]] ++name = "libc" ++version = "0.2.86" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c" ++ ++[[package]] ++name = "lock_api" ++version = "0.4.2" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312" ++dependencies = [ ++ "scopeguard", ++] ++ ++[[package]] ++name = "memoffset" ++version = "0.6.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" ++dependencies = [ ++ "autocfg", ++] ++ ++[[package]] ++name = "num-bigint" ++version = "0.3.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "5e9a41747ae4633fce5adffb4d2e81ffc5e89593cb19917f8fb2cc5ff76507bf" ++dependencies = [ ++ "autocfg", ++ "num-integer", ++ "num-traits", ++] ++ ++[[package]] ++name = "num-complex" ++version = "0.3.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" ++dependencies = [ ++ "num-traits", ++] ++ ++[[package]] ++name = "num-integer" ++version = "0.1.44" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" ++dependencies = [ ++ "autocfg", ++ "num-traits", ++] ++ ++[[package]] ++name = "num-traits" ++version = "0.2.14" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" ++dependencies = [ ++ "autocfg", ++] ++ ++[[package]] ++name = "num_cpus" ++version = "1.13.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" ++dependencies = [ ++ "hermit-abi", ++ "libc", ++] ++ ++[[package]] ++name = "parking_lot" ++version = "0.11.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" ++dependencies = [ ++ "instant", ++ "lock_api", ++ "parking_lot_core", ++] ++ ++[[package]] ++name = "parking_lot_core" ++version = "0.8.3" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" ++dependencies = [ ++ "cfg-if", ++ "instant", ++ "libc", ++ "redox_syscall", ++ "smallvec", ++ "winapi", ++] ++ ++[[package]] ++name = "paste" ++version = "0.1.18" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" ++dependencies = [ ++ "paste-impl", ++ "proc-macro-hack", ++] ++ ++[[package]] ++name = "paste-impl" ++version = "0.1.18" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" ++dependencies = [ ++ "proc-macro-hack", ++] ++ ++[[package]] ++name = "ppv-lite86" ++version = "0.2.10" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" ++ ++[[package]] ++name = "proc-macro-hack" ++version = "0.5.19" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" ++ ++[[package]] ++name = "proc-macro2" ++version = "1.0.24" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" ++dependencies = [ ++ "unicode-xid", ++] ++ ++[[package]] ++name = "proptest" ++version = "0.10.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "12e6c80c1139113c28ee4670dc50cc42915228b51f56a9e407f0ec60f966646f" ++dependencies = [ ++ "bitflags", ++ "byteorder", ++ "lazy_static", ++ "num-traits", ++ "quick-error", ++ "rand", ++ "rand_chacha", ++ "rand_xorshift", ++ "regex-syntax", ++] ++ ++[[package]] ++name = "pyo3" ++version = "0.13.2" ++dependencies = [ ++ "assert_approx_eq", ++ "cfg-if", ++ "ctor", ++ "hashbrown", ++ "indoc", ++ "inventory", ++ "libc", ++ "num-bigint", ++ "num-complex", ++ "parking_lot", ++ "paste", ++ "proptest", ++ "pyo3", ++ "pyo3-macros", ++ "rustversion", ++ "serde", ++ "serde_json", ++ "trybuild", ++ "unindent", ++] ++ ++[[package]] ++name = "pyo3-macros" ++version = "0.13.2" ++dependencies = [ ++ "pyo3-macros-backend", ++ "quote", ++ "syn", ++] ++ ++[[package]] ++name = "pyo3-macros-backend" ++version = "0.13.2" ++dependencies = [ ++ "proc-macro2", ++ "quote", ++ "syn", ++] ++ ++[[package]] ++name = "quick-error" ++version = "1.2.3" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" ++ ++[[package]] ++name = "quote" ++version = "1.0.9" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" ++dependencies = [ ++ "proc-macro2", ++] ++ ++[[package]] ++name = "rand" ++version = "0.7.3" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" ++dependencies = [ ++ "getrandom", ++ "libc", ++ "rand_chacha", ++ "rand_core", ++ "rand_hc", ++] ++ ++[[package]] ++name = "rand_chacha" ++version = "0.2.2" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" ++dependencies = [ ++ "ppv-lite86", ++ "rand_core", ++] ++ ++[[package]] ++name = "rand_core" ++version = "0.5.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" ++dependencies = [ ++ "getrandom", ++] ++ ++[[package]] ++name = "rand_hc" ++version = "0.2.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" ++dependencies = [ ++ "rand_core", ++] ++ ++[[package]] ++name = "rand_xorshift" ++version = "0.2.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "77d416b86801d23dde1aa643023b775c3a462efc0ed96443add11546cdf1dca8" ++dependencies = [ ++ "rand_core", ++] ++ ++[[package]] ++name = "rayon" ++version = "1.5.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" ++dependencies = [ ++ "autocfg", ++ "crossbeam-deque", ++ "either", ++ "rayon-core", ++] ++ ++[[package]] ++name = "rayon-core" ++version = "1.9.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" ++dependencies = [ ++ "crossbeam-channel", ++ "crossbeam-deque", ++ "crossbeam-utils", ++ "lazy_static", ++ "num_cpus", ++] ++ ++[[package]] ++name = "redox_syscall" ++version = "0.2.5" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" ++dependencies = [ ++ "bitflags", ++] ++ ++[[package]] ++name = "regex-syntax" ++version = "0.6.22" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" ++ ++[[package]] ++name = "rustapi-module" ++version = "0.1.0" ++dependencies = [ ++ "pyo3", ++] ++ ++[[package]] ++name = "rustversion" ++version = "1.0.4" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "cb5d2a036dc6d2d8fd16fde3498b04306e29bd193bf306a57427019b823d5acd" ++ ++[[package]] ++name = "ryu" ++version = "1.0.5" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" ++ ++[[package]] ++name = "scopeguard" ++version = "1.1.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" ++ ++[[package]] ++name = "serde" ++version = "1.0.123" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" ++dependencies = [ ++ "serde_derive", ++] ++ ++[[package]] ++name = "serde_derive" ++version = "1.0.123" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" ++dependencies = [ ++ "proc-macro2", ++ "quote", ++ "syn", ++] ++ ++[[package]] ++name = "serde_json" ++version = "1.0.62" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "ea1c6153794552ea7cf7cf63b1231a25de00ec90db326ba6264440fa08e31486" ++dependencies = [ ++ "itoa", ++ "ryu", ++ "serde", ++] ++ ++[[package]] ++name = "smallvec" ++version = "1.6.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" ++ ++[[package]] ++name = "syn" ++version = "1.0.60" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" ++dependencies = [ ++ "proc-macro2", ++ "quote", ++ "unicode-xid", ++] ++ ++[[package]] ++name = "termcolor" ++version = "1.1.2" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" ++dependencies = [ ++ "winapi-util", ++] ++ ++[[package]] ++name = "toml" ++version = "0.5.8" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" ++dependencies = [ ++ "serde", ++] ++ ++[[package]] ++name = "trybuild" ++version = "1.0.41" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "99471a206425fba51842a9186315f32d91c56eadc21ea4c21f847b59cf778f8b" ++dependencies = [ ++ "glob", ++ "lazy_static", ++ "serde", ++ "serde_json", ++ "termcolor", ++ "toml", ++] ++ ++[[package]] ++name = "unicode-xid" ++version = "0.2.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" ++ ++[[package]] ++name = "unindent" ++version = "0.1.7" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" ++ ++[[package]] ++name = "wasi" ++version = "0.9.0+wasi-snapshot-preview1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" ++ ++[[package]] ++name = "winapi" ++version = "0.3.9" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" ++dependencies = [ ++ "winapi-i686-pc-windows-gnu", ++ "winapi-x86_64-pc-windows-gnu", ++] ++ ++[[package]] ++name = "winapi-i686-pc-windows-gnu" ++version = "0.4.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" ++ ++[[package]] ++name = "winapi-util" ++version = "0.1.5" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" ++dependencies = [ ++ "winapi", ++] ++ ++[[package]] ++name = "winapi-x86_64-pc-windows-gnu" ++version = "0.4.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" ++ ++[[package]] ++name = "word-count" ++version = "0.1.0" ++dependencies = [ ++ "pyo3", ++ "rayon", ++] diff --git a/nixpkgs/pkgs/development/tools/rust/maturin/pyo3-test/default.nix b/nixpkgs/pkgs/development/tools/rust/maturin/pyo3-test/default.nix new file mode 100644 index 000000000000..7f79c8565d23 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/maturin/pyo3-test/default.nix @@ -0,0 +1,12 @@ +{ python3 +, rustPlatform +}: + +python3.pkgs.callPackage ./generic.nix { + buildAndTestSubdir = "examples/word-count"; + + nativeBuildInputs = with rustPlatform; [ + cargoSetupHook + maturinBuildHook + ]; +} diff --git a/nixpkgs/pkgs/development/tools/rust/maturin/pyo3-test/generic.nix b/nixpkgs/pkgs/development/tools/rust/maturin/pyo3-test/generic.nix new file mode 100644 index 000000000000..547f11125b70 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/maturin/pyo3-test/generic.nix @@ -0,0 +1,45 @@ +# Derivation prototype, used by maturin and setuptools-rust +# passthrough tests. + +{ lib +, fetchFromGitHub +, python +, rustPlatform + +, nativeBuildInputs + +, buildAndTestSubdir ? null +, format ? "pyproject" +, preConfigure ? "" +}: + +python.pkgs.buildPythonPackage rec { + pname = "word-count"; + version = "0.13.2"; + + src = fetchFromGitHub { + owner = "PyO3"; + repo = "pyo3"; + rev = "v${version}"; + hash = "sha256-NOMrrfo8WjlPhtGxWUOPJS/UDDdbLQRCXR++Zd6JmIA="; + }; + + cargoDeps = rustPlatform.fetchCargoTarball { + inherit src patches; + name = "${pname}-${version}"; + hash = "sha256-u3L9nXHKILznyZTgxdvZyOCQZFZhuADrtI7zXYQzrbE="; + }; + + patches = [ ./Cargo.lock.patch ]; + + inherit buildAndTestSubdir format nativeBuildInputs preConfigure; + + pythonImportsCheck = [ "word_count" ]; + + meta = with lib; { + description = "PyO3 word count example"; + homepage = "https://github.com/PyO3/pyo3"; + license = licenses.asl20; + maintainers = [ ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/probe-run/default.nix b/nixpkgs/pkgs/development/tools/rust/probe-run/default.nix new file mode 100644 index 000000000000..4980baf85e2a --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/probe-run/default.nix @@ -0,0 +1,27 @@ +{ lib, stdenv, rustPlatform, fetchFromGitHub, pkg-config, libusb1 +, libiconv, AppKit, IOKit }: + +rustPlatform.buildRustPackage rec { + pname = "probe-run"; + version = "0.2.5"; + + src = fetchFromGitHub { + owner = "knurling-rs"; + repo = pname; + rev = "v${version}"; + sha256 = "0bj5arngc49mdz1i7bbg4l7rb741x7dhalpdxrn55vzlvgbig8fv"; + }; + + cargoSha256 = "1kqgl1f91aa7kz1yprpyf9pl1vp4ahhw8ka5hrvfvk5i5i54pigz"; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ libusb1 ] + ++ lib.optionals stdenv.isDarwin [ libiconv AppKit IOKit ]; + + meta = with lib; { + description = "Run embedded programs just like native ones."; + homepage = "https://github.com/knurling-rs/probe-run"; + license = with licenses; [ asl20 /* or */ mit ]; + maintainers = with maintainers; [ hoverbear ]; + }; +} 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..e0e22f0f504f --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/racer/default.nix @@ -0,0 +1,48 @@ +{ lib, stdenv, fetchFromGitHub, rustPlatform, makeWrapper, substituteAll, Security }: + +rustPlatform.buildRustPackage rec { + pname = "racer"; + version = "2.1.46"; + + src = fetchFromGitHub { + owner = "racer-rust"; + repo = "racer"; + rev = "v${version}"; + sha256 = "sha256-7h1w5Yyt5VN6+pYuTTbdM1Nrd8aDEhPLusxuIsdS+mQ="; + }; + + cargoSha256 = "sha256-fllhB+so6H36b+joW0l+NBtz3PefOKdj6C8qKQPuJpk="; + + nativeBuildInputs = [ makeWrapper ]; + buildInputs = lib.optional stdenv.isDarwin Security; + + # a nightly compiler is required unless we use this cheat code. + RUSTC_BOOTSTRAP = 1; + + RUST_SRC_PATH = rustPlatform.rustLibSrc; + postInstall = '' + wrapProgram $out/bin/racer --set-default RUST_SRC_PATH ${rustPlatform.rustLibSrc} + ''; + + checkFlags = [ + "--skip nameres::test_do_file_search_std" + "--skip util::test_get_rust_src_path_rustup_ok" + "--skip util::test_get_rust_src_path_not_rust_source_tree" + "--skip extern --skip completes_pub_fn --skip find_crate_doc" + "--skip follows_use_local_package --skip follows_use_for_reexport" + "--skip follows_rand_crate --skip get_completion_in_example_dir" + "--skip test_resolve_global_path_in_modules" + ]; + + doInstallCheck = true; + installCheckPhase = '' + $out/bin/racer --version + ''; + + meta = with 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 ]; + }; +} 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..6ffa49aa6b9f --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/racerd/default.nix @@ -0,0 +1,45 @@ +{ lib, stdenv, fetchFromGitHub, fetchpatch, rustPlatform, makeWrapper, Security }: + +rustPlatform.buildRustPackage rec { + pname = "racerd"; + version = "unstable-2019-09-02"; + + src = fetchFromGitHub { + owner = "jwilm"; + repo = "racerd"; + rev = "e3d380b9a1d3f3b67286d60465746bc89fea9098"; + sha256 = "13jqdvjk4savcl03mrn2vzgdsd7vxv2racqbyavrxp2cm9h6cjln"; + }; + + cargoPatches = [ + (fetchpatch { + url = "https://github.com/jwilm/racerd/commit/856f3656e160cd2909c5166e962f422c901720ee.patch"; + sha256 = "1qq2k4bnwjz5qgn7s8yxd090smwn2wvdm8dd1rrlgpln0a5vxkpb"; + }) + ]; + + cargoSha256 = "08zn65c5ivhn2qs02aiixyqwhywrw8kfvs0kgzxdzsipic47n2qq"; + + # a nightly compiler is required unless we use this cheat code. + RUSTC_BOOTSTRAP=1; + + doCheck = false; + + nativeBuildInputs = [ makeWrapper ]; + buildInputs = lib.optional stdenv.isDarwin Security; + + RUST_SRC_PATH = rustPlatform.rustcSrc; + + installPhase = '' + mkdir -p $out/bin + cp -p $releaseDir/racerd $out/bin/ + wrapProgram $out/bin/racerd --set-default RUST_SRC_PATH "$RUST_SRC_PATH" + ''; + + meta = with lib; { + broken = true; + description = "JSON/HTTP Server based on racer for adding Rust support to editors and IDEs"; + homepage = "https://github.com/jwilm/racerd"; + license = licenses.asl20; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/rust-analyzer/default.nix b/nixpkgs/pkgs/development/tools/rust/rust-analyzer/default.nix new file mode 100644 index 000000000000..7fc5c2b5b527 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/rust-analyzer/default.nix @@ -0,0 +1,61 @@ +{ lib, stdenv, fetchFromGitHub, rustPlatform, CoreServices, cmake +, libiconv +, useMimalloc ? false +, doCheck ? true +}: + +rustPlatform.buildRustPackage rec { + pname = "rust-analyzer-unwrapped"; + version = "2021-09-06"; + cargoSha256 = "sha256-CTCDSoViyVMHxUKQz8fE+r3rkXf7yRgzZ90fZmMtcNM="; + + src = fetchFromGitHub { + owner = "rust-analyzer"; + repo = "rust-analyzer"; + rev = version; + sha256 = "sha256-TacpTVvHAIs4kZ5vibj8luy/kryYwxY+OXFNPnqiXP0="; + }; + + patches = [ + # Code format and git history check require more dependencies but don't really matter for packaging. + # So just ignore them. + ./ignore-git-and-rustfmt-tests.patch + ]; + + buildAndTestSubdir = "crates/rust-analyzer"; + + cargoBuildFlags = lib.optional useMimalloc "--features=mimalloc"; + cargoTestFlags = lib.optional useMimalloc "--features=mimalloc"; + + nativeBuildInputs = lib.optional useMimalloc cmake; + + buildInputs = lib.optionals stdenv.isDarwin [ + CoreServices + libiconv + ]; + + RUST_ANALYZER_REV = version; + + inherit doCheck; + preCheck = lib.optionalString doCheck '' + export RUST_SRC_PATH=${rustPlatform.rustLibSrc} + ''; + + doInstallCheck = true; + installCheckPhase = '' + runHook preInstallCheck + versionOutput="$($out/bin/rust-analyzer --version)" + echo "'rust-analyzer --version' returns: $versionOutput" + [[ "$versionOutput" == "rust-analyzer ${version}" ]] + runHook postInstallCheck + ''; + + passthru.updateScript = ./update.sh; + + meta = with lib; { + description = "An experimental modular compiler frontend for the Rust language"; + homepage = "https://github.com/rust-analyzer/rust-analyzer"; + license = with licenses; [ mit asl20 ]; + maintainers = with maintainers; [ oxalica ]; + }; +} diff --git a/nixpkgs/pkgs/development/tools/rust/rust-analyzer/ignore-git-and-rustfmt-tests.patch b/nixpkgs/pkgs/development/tools/rust/rust-analyzer/ignore-git-and-rustfmt-tests.patch new file mode 100644 index 000000000000..1247e4804684 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/rust-analyzer/ignore-git-and-rustfmt-tests.patch @@ -0,0 +1,18 @@ +--- a/crates/rust-analyzer/tests/slow-tests/tidy.rs ++++ b/crates/rust-analyzer/tests/slow-tests/tidy.rs +@@ -6,6 +6,7 @@ use std::{ + use xshell::{cmd, pushd, pushenv, read_file}; + + #[test] ++#[ignore] + fn check_code_formatting() { + let _dir = pushd(sourcegen::project_root()).unwrap(); + let _e = pushenv("RUSTUP_TOOLCHAIN", "stable"); +@@ -138,6 +139,7 @@ fn check_cargo_toml(path: &Path, text: String) -> () { + } + + #[test] ++#[ignore] + fn check_merge_commits() { + let stdout = cmd!("git rev-list --merges --invert-grep --author 'bors\\[bot\\]' HEAD~19..") + .read() diff --git a/nixpkgs/pkgs/development/tools/rust/rust-analyzer/update.sh b/nixpkgs/pkgs/development/tools/rust/rust-analyzer/update.sh new file mode 100755 index 000000000000..add400e4d0e8 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/rust-analyzer/update.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl jq nix-prefetch libarchive +set -euo pipefail +cd "$(dirname "$0")" +owner=rust-analyzer +repo=rust-analyzer +nixpkgs=../../../../.. + +# Update lsp + +ver=$( + curl -s "https://api.github.com/repos/$owner/$repo/releases" | + jq 'map(select(.prerelease | not)) | .[0].tag_name' --raw-output +) +old_ver=$(sed -nE 's/.*\bversion = "(.*)".*/\1/p' ./default.nix) +if grep -q 'cargoSha256 = ""' ./default.nix; then + old_ver='broken' +fi +if [[ "$ver" == "$old_ver" ]]; then + echo "Up to date: $ver" + exit +fi +echo "$old_ver -> $ver" + +sha256=$(nix-prefetch -f "$nixpkgs" rust-analyzer-unwrapped.src --rev "$ver") +# Clear cargoSha256 to avoid inconsistency. +sed -e "s#version = \".*\"#version = \"$ver\"#" \ + -e "/fetchFromGitHub/,/}/ s#sha256 = \".*\"#sha256 = \"$sha256\"#" \ + -e "s#cargoSha256 = \".*\"#cargoSha256 = \"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\"#" \ + --in-place ./default.nix +node_src="$(nix-build "$nixpkgs" -A rust-analyzer.src --no-out-link)/editors/code" + +# Check vscode compatibility +req_vscode_ver="$(jq '.engines.vscode' "$node_src/package.json" --raw-output)" +req_vscode_ver="${req_vscode_ver#^}" +cur_vscode_ver="$(nix-instantiate --eval --strict "$nixpkgs" -A vscode.version | tr -d '"')" +if [[ "$(nix-instantiate --eval --strict -E "(builtins.compareVersions \"$req_vscode_ver\" \"$cur_vscode_ver\")")" -gt 0 ]]; then + echo "vscode $cur_vscode_ver is incompatible with the extension requiring ^$req_vscode_ver" + exit 1 +fi + +echo "Prebuilding for cargoSha256" +cargo_sha256=$(nix-prefetch "{ sha256 }: (import $nixpkgs {}).rust-analyzer-unwrapped.cargoDeps.overrideAttrs (_: { outputHash = sha256; })") +sed "s#cargoSha256 = \".*\"#cargoSha256 = \"$cargo_sha256\"#" \ + --in-place ./default.nix + +# Update vscode extension + +extension_ver=$(curl "https://github.com/rust-analyzer/rust-analyzer/releases/download/$ver/rust-analyzer.vsix" -L | + bsdtar -xf - --to-stdout extension/package.json | # Use bsdtar to extract vsix(zip). + jq --raw-output '.version') +echo "Extension version: $extension_ver" + +build_deps="../../../../misc/vscode-extensions/rust-analyzer/build-deps" +# We need devDependencies to build vsix. +# `esbuild` is a binary package an is already in nixpkgs so we omit it here. +jq '{ name, version: $ver, dependencies: (.dependencies + .devDependencies | del(.esbuild)) }' "$node_src/package.json" \ + --arg ver "$extension_ver" \ + >"$build_deps/package.json.new" + +old_deps="$(jq '.dependencies' "$build_deps"/package.json)" +new_deps="$(jq '.dependencies' "$build_deps"/package.json.new)" +if [[ "$old_deps" == "$new_deps" ]]; then + echo "package.json dependencies not changed, do simple version change" + + sed -E '/^ "rust-analyzer-build-deps/,+3 s/version = ".*"/version = "'"$extension_ver"'"/' \ + --in-place ../../../node-packages/node-packages.nix + mv "$build_deps"/package.json{.new,} + +else + echo "package.json dependencies changed, updating nodePackages" + mv "$build_deps"/package.json{.new,} + + pushd "../../../node-packages" + ./generate.sh + popd +fi diff --git a/nixpkgs/pkgs/development/tools/rust/rust-analyzer/wrapper.nix b/nixpkgs/pkgs/development/tools/rust/rust-analyzer/wrapper.nix new file mode 100644 index 000000000000..6fa5207de6eb --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/rust-analyzer/wrapper.nix @@ -0,0 +1,15 @@ +{ lib, rustPlatform, runCommand, makeWrapper, rust-analyzer-unwrapped +, pname ? "rust-analyzer" +, version ? rust-analyzer-unwrapped.version + # Use name from `RUST_SRC_PATH` +, rustSrc ? rustPlatform.rustLibSrc +}: +runCommand "${pname}-${version}" { + inherit pname version; + inherit (rust-analyzer-unwrapped) src meta; + nativeBuildInputs = [ makeWrapper ]; +} '' + mkdir -p $out/bin + makeWrapper ${rust-analyzer-unwrapped}/bin/rust-analyzer $out/bin/rust-analyzer \ + --set-default RUST_SRC_PATH "${rustSrc}" +'' diff --git a/nixpkgs/pkgs/development/tools/rust/rustup-toolchain-install-master/0001-dynamically-patchelf-binaries.patch b/nixpkgs/pkgs/development/tools/rust/rustup-toolchain-install-master/0001-dynamically-patchelf-binaries.patch new file mode 100644 index 000000000000..1754ce11c4d3 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/rustup-toolchain-install-master/0001-dynamically-patchelf-binaries.patch @@ -0,0 +1,61 @@ +diff --git a/src/main.rs b/src/main.rs +index 3cb6896..7f070e0 100644 +--- a/src/main.rs ++++ b/src/main.rs +@@ -275,7 +275,9 @@ fn install_single_toolchain( + + // install + if maybe_dry_client.is_some() { +- rename(&toolchain.dest, toolchain_path)?; ++ rename(&toolchain.dest, toolchain_path.clone())?; ++ nix_patchelf(toolchain_path) ++ .expect("failed to patch toolchain for NixOS"); + eprintln!( + "toolchain `{}` is successfully installed!", + toolchain.dest.display() +@@ -291,6 +293,45 @@ fn install_single_toolchain( + Ok(()) + } + ++fn nix_patchelf(mut toolchain_path: PathBuf) -> Result<(), Error> { ++ toolchain_path.push("bin"); ++ ++ for entry in toolchain_path.read_dir()? { ++ let entry = entry?; ++ if !entry.file_type()?.is_file() { ++ continue; ++ } ++ ++ eprintln!("info: you seem to be running NixOS. Attempting to patch {}", ++ entry.path().to_str().unwrap()); ++ let _ = ::std::process::Command::new("@patchelf@/bin/patchelf") ++ .arg("--set-interpreter") ++ .arg("@dynamicLinker@") ++ .arg(entry.path()) ++ .output(); ++ } ++ ++ toolchain_path.pop(); ++ toolchain_path.push("lib"); ++ ++ for entry in toolchain_path.read_dir()? { ++ let entry = entry?; ++ if !entry.file_type()?.is_file() { ++ continue; ++ } ++ ++ eprintln!("info: you seem to be running NixOS. Attempting to patch {}", ++ entry.path().to_str().unwrap()); ++ let _ = ::std::process::Command::new("@patchelf@/bin/patchelf") ++ .arg("--set-rpath") ++ .arg("@libPath@") ++ .arg(entry.path()) ++ .output(); ++ } ++ ++ Ok(()) ++} ++ + fn fetch_master_commit(client: &Client, github_token: Option<&str>) -> Result<String, Error> { + eprintln!("fetching master commit hash... "); + fetch_master_commit_via_git() diff --git a/nixpkgs/pkgs/development/tools/rust/rustup-toolchain-install-master/default.nix b/nixpkgs/pkgs/development/tools/rust/rustup-toolchain-install-master/default.nix new file mode 100644 index 000000000000..cae5453fa661 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/rustup-toolchain-install-master/default.nix @@ -0,0 +1,56 @@ +{ stdenv +, lib +, fetchFromGitHub +, rustPlatform +, pkg-config +, openssl +, runCommand +, patchelf +, zlib +, Security +}: + +rustPlatform.buildRustPackage rec { + pname = "rustup-toolchain-install-master"; + version = "1.7.3"; + + src = fetchFromGitHub { + owner = "kennytm"; + repo = pname; + rev = "v${version}"; + hash = "sha256-J25ER/g8Kylw/oTIEl4Gl8i1xmhR+4JM5M5EHpl1ras="; + }; + + patches = + let + patchelfPatch = runCommand "0001-dynamically-patchelf-binaries.patch" { + CC = stdenv.cc; + patchelf = patchelf; + libPath = "$ORIGIN/../lib:${lib.makeLibraryPath [ zlib ]}"; + } + '' + export dynamicLinker=$(cat $CC/nix-support/dynamic-linker) + substitute ${./0001-dynamically-patchelf-binaries.patch} $out \ + --subst-var patchelf \ + --subst-var dynamicLinker \ + --subst-var libPath + ''; + in + lib.optionals stdenv.isLinux [ patchelfPatch ]; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ + openssl + ] ++ lib.optionals stdenv.isDarwin [ + Security + ]; + + cargoSha256 = "n7t8Ap9hdhrjmtKjfdyozf26J7yhu57pedm19CunLF4="; + + meta = with lib; { + description = "Install a rustc master toolchain usable from rustup"; + homepage = "https://github.com/kennytm/rustup-toolchain-install-master"; + license = licenses.mit; + maintainers = with maintainers; [ davidtwco ]; + }; +} 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..13649b387a3e --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/rustup/0001-dynamically-patchelf-binaries.patch @@ -0,0 +1,42 @@ +diff --git a/src/dist/component/package.rs b/src/dist/component/package.rs +index 3beddf54..0f859b8d 100644 +--- a/src/dist/component/package.rs ++++ b/src/dist/component/package.rs +@@ -113,6 +113,7 @@ impl Package for DirectoryPackage { + } else { + builder.move_file(path.clone(), &src_path)? + } ++ nix_patchelf_if_needed(&target.prefix().path().join(path.clone()), &src_path) + } + "dir" => { + if self.copy { +@@ -135,6 +136,29 @@ impl Package for DirectoryPackage { + } + } + ++fn nix_patchelf_if_needed(dest_path: &Path, src_path: &Path) { ++ let (is_bin, is_lib) = if let Some(p) = src_path.parent() { ++ (p.ends_with("bin"), p.ends_with("lib")) ++ } else { ++ (false, false) ++ }; ++ ++ if is_bin { ++ let _ = ::std::process::Command::new("@patchelf@/bin/patchelf") ++ .arg("--set-interpreter") ++ .arg("@dynamicLinker@") ++ .arg(dest_path) ++ .output(); ++ } ++ else if is_lib { ++ let _ = ::std::process::Command::new("@patchelf@/bin/patchelf") ++ .arg("--set-rpath") ++ .arg("@libPath@") ++ .arg(dest_path) ++ .output(); ++ } ++} ++ + #[derive(Debug)] + pub struct TarPackage<'a>(DirectoryPackage, temp::Dir<'a>); + 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..d18d1a0ec37b --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/rustup/default.nix @@ -0,0 +1,92 @@ +{ stdenv +, lib +, runCommand +, patchelf +, fetchFromGitHub +, rustPlatform +, makeWrapper +, pkg-config +, curl +, zlib +, Security +, CoreServices +, libiconv +, xz +}: + +let + libPath = lib.makeLibraryPath [ + zlib # libz.so.1 + ]; +in + +rustPlatform.buildRustPackage rec { + pname = "rustup"; + version = "1.24.2"; + + src = fetchFromGitHub { + owner = "rust-lang"; + repo = "rustup"; + rev = version; + sha256 = "sha256-uRCzVeTr5rr0CvE/1Uz7RHcw4Kt/sOItwcbZJBjjNjg="; + }; + + cargoSha256 = "sha256-+E6Wa4QrMG/Ow3KehsxIzLzubXJQxCWo/rowC4MPdgk="; + + nativeBuildInputs = [ makeWrapper pkg-config ]; + + buildInputs = [ + curl + zlib + ] ++ lib.optionals stdenv.isDarwin [ CoreServices Security libiconv xz ]; + + cargoBuildFlags = [ "--features no-self-update" ]; + + patches = lib.optionals stdenv.isLinux [ + (runCommand "0001-dynamically-patchelf-binaries.patch" { CC = stdenv.cc; patchelf = patchelf; libPath = "$ORIGIN/../lib:${libPath}"; } '' + export dynamicLinker=$(cat $CC/nix-support/dynamic-linker) + substitute ${./0001-dynamically-patchelf-binaries.patch} $out \ + --subst-var patchelf \ + --subst-var dynamicLinker \ + --subst-var libPath + '') + ]; + + doCheck = !stdenv.isAarch64 && !stdenv.isDarwin; + + 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 + + wrapProgram $out/bin/rustup --prefix "LD_LIBRARY_PATH" : "${libPath}" + + # tries to create .rustup + export HOME=$(mktemp -d) + mkdir -p "$out/share/"{bash-completion/completions,fish/vendor_completions.d,zsh/site-functions} + + # generate completion scripts for rustup + $out/bin/rustup completions bash rustup > "$out/share/bash-completion/completions/rustup" + $out/bin/rustup completions fish rustup > "$out/share/fish/vendor_completions.d/rustup.fish" + $out/bin/rustup completions zsh rustup > "$out/share/zsh/site-functions/_rustup" + + # generate completion scripts for cargo + # Note: fish completion script is not supported. + $out/bin/rustup completions bash cargo > "$out/share/bash-completion/completions/cargo" + $out/bin/rustup completions zsh cargo > "$out/share/zsh/site-functions/_cargo" + ''; + + meta = with 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/sqlx-cli/default.nix b/nixpkgs/pkgs/development/tools/rust/sqlx-cli/default.nix new file mode 100644 index 000000000000..15b6b085bb05 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/sqlx-cli/default.nix @@ -0,0 +1,30 @@ +{ stdenv, lib, rustPlatform, fetchFromGitHub, pkg-config, openssl, SystemConfiguration, CoreFoundation, Security, libiconv }: + +rustPlatform.buildRustPackage rec { + pname = "sqlx-cli"; + version = "0.5.7"; + + src = fetchFromGitHub { + owner = "launchbadge"; + repo = "sqlx"; + rev = "v${version}"; + sha256 = "sha256-BYTAAzex3h9iEKFuPCyCXKokPLcgA0k9Zk6aMcWac+c="; + }; + + cargoSha256 = "sha256-3Fdoo8gvoLXe9fEAzKh7XY0LDVGsYsqB6NRlU8NqCMI="; + + doCheck = false; + cargoBuildFlags = [ "-p sqlx-cli" ]; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = lib.optionals stdenv.isLinux [ openssl ] + ++ lib.optionals stdenv.isDarwin [ SystemConfiguration CoreFoundation Security libiconv ]; + + meta = with lib; { + description = + "SQLx's associated command-line utility for managing databases, migrations, and enabling offline mode with sqlx::query!() and friends."; + homepage = "https://github.com/launchbadge/sqlx"; + license = licenses.asl20; + maintainers = with maintainers; [ greizgh ]; + }; +} 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..acc9b053593b --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/svd2rust/cargo-lock.patch @@ -0,0 +1,474 @@ +diff --git a/Cargo.lock b/Cargo.lock +new file mode 100644 +--- /dev/null ++++ b/Cargo.lock +@@ -0,0 +1,469 @@ ++# This file is automatically @generated by Cargo. ++# It is not intended for manual editing. ++[[package]] ++name = "aho-corasick" ++version = "0.7.15" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "ansi_term" ++version = "0.11.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "anyhow" ++version = "1.0.40" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "atty" ++version = "0.2.14" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.94 (registry+https://github.com/rust-lang/crates.io-index)", ++ "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "autocfg" ++version = "1.0.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "bitflags" ++version = "1.2.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "cast" ++version = "0.2.5" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "cfg-if" ++version = "1.0.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "clap" ++version = "2.33.3" ++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.14 (registry+https://github.com/rust-lang/crates.io-index)", ++ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ++ "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ++ "vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "crossbeam-channel" ++version = "0.5.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "crossbeam-deque" ++version = "0.8.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", ++ "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "crossbeam-epoch" ++version = "0.9.3" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ++ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "memoffset 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", ++ "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "crossbeam-utils" ++version = "0.8.3" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ++ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "either" ++version = "1.6.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "env_logger" ++version = "0.7.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ++ "humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", ++ "regex 1.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ++ "termcolor 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "hermit-abi" ++version = "0.1.18" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "libc 0.2.94 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "humantime" ++version = "1.3.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "quick-error 1.2.3 (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 = "lazy_static" ++version = "1.4.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "libc" ++version = "0.2.94" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "log" ++version = "0.4.14" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "memchr" ++version = "2.3.4" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "memoffset" ++version = "0.6.3" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "num_cpus" ++version = "1.13.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.94 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "once_cell" ++version = "1.7.2" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "proc-macro2" ++version = "1.0.26" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "quick-error" ++version = "1.2.3" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "quote" ++version = "1.0.9" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "proc-macro2 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "rayon" ++version = "1.5.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ++ "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ++ "rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "rayon-core" ++version = "1.9.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "crossbeam-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ++ "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ++ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "regex" ++version = "1.4.6" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", ++ "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ++ "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "regex-syntax" ++version = "0.6.23" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "rustc_version" ++version = "0.2.3" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "scopeguard" ++version = "1.1.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "semver" ++version = "0.9.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "semver-parser" ++version = "0.7.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "strsim" ++version = "0.8.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "svd-parser" ++version = "0.10.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "anyhow 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ++ "once_cell 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ++ "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "regex 1.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ++ "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", ++ "xmltree 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "svd2rust" ++version = "0.18.0" ++dependencies = [ ++ "anyhow 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ++ "cast 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ++ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", ++ "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ++ "inflections 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ++ "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", ++ "proc-macro2 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", ++ "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", ++ "svd-parser 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ++ "syn 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", ++ "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "syn" ++version = "1.0.70" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "proc-macro2 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", ++ "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", ++ "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "termcolor" ++version = "1.1.2" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "textwrap" ++version = "0.11.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "thiserror" ++version = "1.0.24" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "thiserror-impl" ++version = "1.0.24" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "proc-macro2 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", ++ "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", ++ "syn 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "unicode-width" ++version = "0.1.8" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "unicode-xid" ++version = "0.2.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "vec_map" ++version = "0.8.2" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++ ++[[package]] ++name = "winapi" ++version = "0.3.9" ++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-util" ++version = "0.1.5" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "winapi 0.3.9 (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.7.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[[package]] ++name = "xmltree" ++version = "0.8.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++dependencies = [ ++ "xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ++] ++ ++[metadata] ++"checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" ++"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" ++"checksum anyhow 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "28b2cd92db5cbd74e8e5028f7e27dd7aa3090e89e4f2a197cc7c8dfb69c7063b" ++"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" ++"checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" ++"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" ++"checksum cast 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "cc38c385bfd7e444464011bb24820f40dd1c76bcdfa1b78611cb7c2e5cafab75" ++"checksum cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" ++"checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" ++"checksum crossbeam-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" ++"checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" ++"checksum crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" ++"checksum crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" ++"checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" ++"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" ++"checksum hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" ++"checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" ++"checksum inflections 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a257582fdcde896fd96463bf2d40eefea0580021c0712a0e2b028b60b47a837a" ++"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" ++"checksum libc 0.2.94 (registry+https://github.com/rust-lang/crates.io-index)" = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e" ++"checksum log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" ++"checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" ++"checksum memoffset 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d" ++"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" ++"checksum once_cell 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" ++"checksum proc-macro2 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" ++"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" ++"checksum quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" ++"checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" ++"checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" ++"checksum regex 1.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2a26af418b574bd56588335b3a3659a65725d4e636eb1016c2f9e3b38c7cc759" ++"checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" ++"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" ++"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" ++"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" ++"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" ++"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" ++"checksum svd-parser 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6b787831d8f6a1549ccd1b0d62772d0526425a7da687f0f98591ab18e53bfe98" ++"checksum syn 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)" = "b9505f307c872bab8eb46f77ae357c8eba1fdacead58ee5a850116b1d7f82883" ++"checksum termcolor 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" ++"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" ++"checksum thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" ++"checksum thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" ++"checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" ++"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" ++"checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" ++"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" ++"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" ++"checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" ++"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" ++"checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2" ++"checksum xmltree 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8eaee9d17062850f1e6163b509947969242990ee59a35801af437abe041e70" 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..c66cbe3c2c82 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/rust/svd2rust/default.nix @@ -0,0 +1,26 @@ +{ lib, stdenv, fetchFromGitHub, rustPlatform, libiconv }: + +with rustPlatform; + +buildRustPackage rec { + pname = "svd2rust"; + version = "0.18.0"; + + src = fetchFromGitHub { + owner = "rust-embedded"; + repo = "svd2rust"; + rev = "v${version}"; + sha256 = "1p0zq3q4g9lr0ghavp7v1dwsqq19lkljkm1i2hsb1sk3pxa1f69n"; + }; + cargoPatches = [ ./cargo-lock.patch ]; + + cargoSha256 = "0c0f86x17fzav5q76z3ha3g00rbgyz2lm5a5v28ggy0jmg9xgsv6"; + + buildInputs = lib.optional stdenv.isDarwin libiconv; + + meta = with lib; { + description = "Generate Rust register maps (`struct`s) from SVD files"; + homepage = "https://github.com/rust-embedded/svd2rust"; + license = with licenses; [ mit asl20 ]; + }; +} |