about summary refs log tree commit diff
path: root/pkgs/tools/security/echidna/default.nix
blob: f3bfb9fbffeec154b94540efd9a7fa370744da91 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
{
  stdenv,
  lib,
  fetchpatch,
  mkDerivation,
  fetchFromGitHub,
  haskellPackages,
  slither-analyzer,
}:

mkDerivation (
  rec {
    pname = "echidna";
    version = "2.2.3";

    src = fetchFromGitHub {
      owner = "crytic";
      repo = "echidna";
      rev = "v${version}";
      sha256 = "sha256-NJ2G6EkexYE4P3GD7PZ+lLEs1dqnoqIB2zfAOD5SQ8M=";
    };

    patches = [
      # Support cross platform vty 6.x with vty-crossplatform
      # https://github.com/crytic/echidna/pull/1290
      (fetchpatch {
        url = "https://github.com/crytic/echidna/commit/2913b027d7e793390ed489ef6a47d23ec9b3c800.patch";
        hash = "sha256-5CGD9nDbDUTG869xUybWYSvGRsrm7JP7n0WMBNYfayw=";
      })
    ];

    isExecutable = true;

    libraryToolDepends = with haskellPackages; [ haskellPackages.hpack ];

    executableHaskellDepends = with haskellPackages; [
      # package.yaml - dependencies
      base
      aeson
      async
      base16-bytestring
      binary
      bytestring
      code-page
      containers
      data-bword
      data-dword
      deepseq
      extra
      directory
      exceptions
      filepath
      hashable
      hevm
      html-entities
      ListLike
      MonadRandom
      mtl
      optparse-applicative
      optics
      optics-core
      process
      random
      rosezipper
      semver
      split
      text
      transformers
      time
      unliftio
      utf8-string
      vector
      with-utf8
      word-wrap
      yaml
      http-conduit
      html-conduit
      warp
      wai-extra
      xml-conduit
      strip-ansi-escape
      # package.yaml - dependencies when "!os(windows)"
      brick
      unix
      vty
    ];

    # Note: there is also a runtime dependency of slither-analyzer. So, let's include it.
    executableSystemDepends = [ slither-analyzer ];

    preConfigure = ''
      hpack
    '';

    shellHook = "hpack";

    doHaddock = false;

    # tests depend on a specific version of solc
    doCheck = false;

    description = "Ethereum smart contract fuzzer";
    homepage = "https://github.com/crytic/echidna";
    license = lib.licenses.agpl3Plus;
    maintainers = with lib.maintainers; [
      arturcygan
      hellwolf
    ];
    platforms = lib.platforms.unix;
    mainProgram = "echidna-test";

  }
  // lib.optionalAttrs (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) {

    # https://github.com/NixOS/nixpkgs/pull/304352
    postInstall = with haskellPackages; ''
      remove-references-to -t ${warp.out} "$out/bin/echidna"
      remove-references-to -t ${wreq.out} "$out/bin/echidna"
    '';
  }
)