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