about summary refs log tree commit diff
path: root/pkgs/development/compilers/rust
diff options
context:
space:
mode:
authorBas van Dijk <v.dijk.bas@gmail.com>2019-08-15 16:13:01 +0200
committerBas van Dijk <v.dijk.bas@gmail.com>2019-08-16 09:18:32 +0200
commit682e6fafa427e592610d1cac406c038bb206c183 (patch)
tree6ae701e032eb3f1491ca2cf56e168adefff45811 /pkgs/development/compilers/rust
parentc0e56afddbcf6002e87a5ab0e8e17f381e3aa9bd (diff)
downloadnixlib-682e6fafa427e592610d1cac406c038bb206c183.tar
nixlib-682e6fafa427e592610d1cac406c038bb206c183.tar.gz
nixlib-682e6fafa427e592610d1cac406c038bb206c183.tar.bz2
nixlib-682e6fafa427e592610d1cac406c038bb206c183.tar.lz
nixlib-682e6fafa427e592610d1cac406c038bb206c183.tar.xz
nixlib-682e6fafa427e592610d1cac406c038bb206c183.tar.zst
nixlib-682e6fafa427e592610d1cac406c038bb206c183.zip
rustPackages.clippy: init at rust-1.36.0
Diffstat (limited to 'pkgs/development/compilers/rust')
-rw-r--r--pkgs/development/compilers/rust/clippy.nix35
-rw-r--r--pkgs/development/compilers/rust/default.nix1
2 files changed, 36 insertions, 0 deletions
diff --git a/pkgs/development/compilers/rust/clippy.nix b/pkgs/development/compilers/rust/clippy.nix
new file mode 100644
index 000000000000..2b8fcbe0ba4b
--- /dev/null
+++ b/pkgs/development/compilers/rust/clippy.nix
@@ -0,0 +1,35 @@
+{ stdenv, lib, rustPlatform, rustc, Security, patchelf }:
+rustPlatform.buildRustPackage rec {
+  name = "clippy-${rustc.version}";
+  inherit (rustc) version src;
+
+  # the rust source tarball already has all the dependencies vendored, no need to fetch them again
+  cargoVendorDir = "vendor";
+  preBuild = "pushd src/tools/clippy";
+  postBuild = "popd";
+
+  # changes hash of vendor directory otherwise
+  dontUpdateAutotoolsGnuConfigScripts = true;
+
+  buildInputs = [ rustc ] ++ stdenv.lib.optionals stdenv.isDarwin [ Security ];
+
+  # fixes: error: the option `Z` is only accepted on the nightly compiler
+  RUSTC_BOOTSTRAP = 1;
+
+  # Without disabling the test the build fails with:
+  # error: failed to run custom build command for `rustc_llvm v0.0.0
+  #   (/private/tmp/nix-build-clippy-1.36.0.drv-0/rustc-1.36.0-src/src/librustc_llvm)
+  doCheck = false;
+
+  preFixup = stdenv.lib.optionalString stdenv.isDarwin ''
+    install_name_tool -add_rpath "${rustc}/lib" $out/bin/clippy-driver
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://rust-lang.github.io/rust-clippy/;
+    description = "A bunch of lints to catch common mistakes and improve your Rust code";
+    maintainers = with maintainers; [ basvandijk ];
+    license = with licenses; [ mit asl20 ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix
index 0e3de0c4ab98..fb04239dbd4b 100644
--- a/pkgs/development/compilers/rust/default.nix
+++ b/pkgs/development/compilers/rust/default.nix
@@ -64,6 +64,7 @@
         rustPlatform = bootRustPlatform;
         inherit CoreFoundation Security;
       };
+      clippy = self.callPackage ./clippy.nix { inherit Security; };
     });
   };
 }