1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5, makeWrapper
6, pythonOlder
7, crytic-compile
8, prettytable
9, setuptools
10, solc
11 # solc is currently broken on Darwin, default to false
12, withSolc ? !stdenv.isDarwin
13}:
14
15buildPythonPackage rec {
16 pname = "slither-analyzer";
17 version = "0.8.1";
18 disabled = pythonOlder "3.6";
19
20 src = fetchPypi {
21 inherit pname version;
22 sha256 = "sha256-5JgF53ip72bne8AlGf126FIIvXi+u7rovJmMSCcZjEQ=";
23 };
24
25 nativeBuildInputs = [
26 makeWrapper
27 ];
28
29 propagatedBuildInputs = [
30 crytic-compile
31 prettytable
32 setuptools
33 ];
34
35 postFixup = lib.optionalString withSolc ''
36 wrapProgram $out/bin/slither \
37 --prefix PATH : "${lib.makeBinPath [ solc ]}"
38 '';
39
40 # No Python tests
41 doCheck = false;
42
43 meta = with lib; {
44 description = "Static Analyzer for Solidity";
45 longDescription = ''
46 Slither is a Solidity static analysis framework written in Python 3. It
47 runs a suite of vulnerability detectors, prints visual information about
48 contract details, and provides an API to easily write custom analyses.
49 '';
50 homepage = "https://github.com/trailofbits/slither";
51 license = licenses.agpl3Plus;
52 maintainers = with maintainers; [ arturcygan fab ];
53 };
54}