-
Notifications
You must be signed in to change notification settings - Fork 387
/
Copy pathdefault.nix
82 lines (77 loc) · 3.23 KB
/
default.nix
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
{ pkgs ? import (builtins.fetchTarball {
name = "nixpkgs-21.03pre268255.e5b478271ea";
url = "https://github.com/nixos/nixpkgs/archive/e5b478271ea0af7b75d53c92cfa98bdb126b44a7.tar.gz";
sha256 = "06hmxvnx2swk63i15zp1q70axf53x04f7ywwlnxlcfkk0prrmwbh";
}) {}
}:
let
# slither is shipped with solc by default, we don't use it as we need
# precise solc versions
slither-analyzer = pkgs.slither-analyzer.override { withSolc = false; };
# this is not perfect for development as it hardcodes solc to 0.5.7, test suite runs fine though
# would be great to integrate solc-select to be more flexible, improve this in future
solc = pkgs.stdenv.mkDerivation {
name = "solc";
src = if pkgs.stdenv.isDarwin then
pkgs.fetchurl {
url = "https://binaries.soliditylang.org/macosx-amd64/solc-macosx-amd64-v0.5.7+commit.6da8b019";
sha256 = "0p6s5d34qz4h3463jllciiy9cgfwvp3dqlc63pa4ryjmjvi7fyil";
}
else
pkgs.fetchurl {
url = "https://binaries.soliditylang.org/linux-amd64/solc-linux-amd64-v0.5.7+commit.6da8b019";
sha256 = "0dsvzck5jh8rvdxs7zyn2ga9hif024msx8gr8ifgj4cmyb7m4341";
};
phases = ["installPhase" "patchPhase"];
installPhase = ''
mkdir -p $out/bin
cp $src $out/bin/solc
chmod +x $out/bin/solc
'';
};
v = "1.6.1";
f = { mkDerivation, aeson, ansi-terminal, base, base16-bytestring
, binary, brick, bytestring, cborg, containers, data-dword, data-has
, deepseq, directory, exceptions, filepath, hashable, hevm, hpack
, lens, lens-aeson, megaparsec, MonadRandom, mtl
, optparse-applicative, process, random, stm, tasty
, tasty-hunit, tasty-quickcheck, temporary, text, transformers
, unix, unliftio, unliftio-core, unordered-containers, vector
, vector-instances, vty, wl-pprint-annotated, word8, yaml
, cabal-install, extra, ListLike, hlint, semver
}:
mkDerivation rec {
pname = "echidna";
version = v;
src = ./.;
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
aeson ansi-terminal base base16-bytestring binary brick bytestring
cborg containers data-dword data-has deepseq directory exceptions filepath
hashable hevm lens lens-aeson megaparsec MonadRandom mtl
optparse-applicative process random stm temporary text transformers
unix unliftio unliftio-core unordered-containers vector
vector-instances vty wl-pprint-annotated word8 yaml extra ListLike
semver
] ++ (if pkgs.lib.inNixShell then testHaskellDepends else []);
libraryToolDepends = [ hpack cabal-install hlint slither-analyzer solc ];
executableHaskellDepends = libraryHaskellDepends;
testHaskellDepends = [
tasty tasty-hunit tasty-quickcheck
];
preConfigure = ''
hpack
# re-enable dynamic build for Linux
sed -i -e 's/os(linux)/false/' echidna.cabal
'';
shellHook = "hpack";
license = pkgs.lib.licenses.agpl3;
doHaddock = false;
doCheck = true;
};
drv = pkgs.haskellPackages.callPackage f { };
in
if pkgs.lib.inNixShell
then drv.env
else pkgs.haskell.lib.justStaticExecutables drv