1{ lib
2, stdenv
3, buildPythonPackage
4, crytic-compile
5, fetchFromGitHub
6, makeWrapper
7, packaging
8, prettytable
9, pythonOlder
10, setuptools
11, solc
12, web3
13, withSolc ? false
14}:
15
16buildPythonPackage rec {
17 pname = "slither-analyzer";
18 version = "0.10.0";
19 format = "setuptools";
20
21 disabled = pythonOlder "3.8";
22
23 src = fetchFromGitHub {
24 owner = "crytic";
25 repo = "slither";
26 rev = "refs/tags/${version}";
27 hash = "sha256-lyjHubnYIwGiA6uAt9erKlTr2sCRGHQy/ZkNByFrFgM=";
28 };
29
30 nativeBuildInputs = [
31 makeWrapper
32 ];
33
34 propagatedBuildInputs = [
35 crytic-compile
36 packaging
37 prettytable
38 setuptools
39 web3
40 ];
41
42 postFixup = lib.optionalString withSolc ''
43 wrapProgram $out/bin/slither \
44 --prefix PATH : "${lib.makeBinPath [ solc ]}"
45 '';
46
47 # No Python tests
48 doCheck = false;
49
50 meta = with lib; {
51 description = "Static Analyzer for Solidity";
52 longDescription = ''
53 Slither is a Solidity static analysis framework written in Python 3. It
54 runs a suite of vulnerability detectors, prints visual information about
55 contract details, and provides an API to easily write custom analyses.
56 '';
57 homepage = "https://github.com/trailofbits/slither";
58 changelog = "https://github.com/crytic/slither/releases/tag/${version}";
59 license = licenses.agpl3Plus;
60 maintainers = with maintainers; [ arturcygan fab hellwolf ];
61 };
62}