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