-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
83 lines (78 loc) · 3.21 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
83
{ pkgs ? import (builtins.fetchTarball {
name = "nixpkgs-unstable-2021-08-11";
url = "https://github.com/nixos/nixpkgs/archive/0ac49d7c7b5625a2554f393ddfba72128c8f0f5d.tar.gz";
sha256 = "sha256:03s2k619fvsxv28gk574pphhf4k3y8dxm8ir3d3vvp04i7n4z6wj";
}) {}
}:
let
# 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 = "095mlw5x9lpdcdl9jzlvkvw46ag03xr4nj4vly4hgn92rgivimm7";
}
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
'';
};
slither-analyzer = pkgs.slither-analyzer.override { withSolc = false; };
v = "1.7.2";
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, haskell-language-server
}:
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
haskell-language-server
];
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