1 { lib, gccStdenv, fetchzip, boost, cmake, ncurses, python3, coreutils
2 , z3Support ? true, z3 ? null, cvc4Support ? true, cvc4 ? null
3 , cln ? null, gmp ? null
6 # compiling source/libsmtutil/CVC4Interface.cpp breaks on clang on Darwin,
7 # general commandline tests fail at abiencoderv2_no_warning/ on clang on NixOS
9 assert z3Support -> z3 != null && lib.versionAtLeast z3.version "4.6.0";
10 assert cvc4Support -> cvc4 != null && cln != null && gmp != null;
13 jsoncppVersion = "1.9.4";
14 jsoncppUrl = "https://github.com/open-source-parsers/jsoncpp/archive/${jsoncppVersion}.tar.gz";
17 sha256 = "0qnx5y6c90fphl9mj9d20j2dfgy6s5yr5l0xnzid0vh71zrp6jwv";
20 gccStdenv.mkDerivation rec {
25 # upstream suggests avoid using archive generated by github
27 url = "https://github.com/ethereum/solidity/releases/download/v${version}/solidity_${version}.tar.gz";
28 sha256 = "02261l54jdbvxk612z7zsyvmchy1rx4lf27b3f616sd7r56krpkg";
32 substituteInPlace cmake/jsoncpp.cmake \
33 --replace "${jsoncppUrl}" ${jsoncpp}
37 "-DBoost_USE_STATIC_LIBS=OFF"
38 ] ++ lib.optionals (!z3Support) [
40 ] ++ lib.optionals (!cvc4Support) [
44 nativeBuildInputs = [ cmake ];
45 buildInputs = [ boost ]
46 ++ lib.optionals z3Support [ z3 ]
47 ++ lib.optionals cvc4Support [ cvc4 cln gmp ];
48 checkInputs = [ ncurses python3 ];
50 # Test fails on darwin for unclear reason
51 doCheck = gccStdenv.hostPlatform.isLinux;
54 while IFS= read -r -d ''' dir
56 LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$(pwd)/$dir
57 export LD_LIBRARY_PATH
58 done < <(find . -type d -print0)
61 # IPC tests need aleth avaliable, so we disable it
62 sed -i "s/IPC_ENABLED=true/IPC_ENABLED=false\nIPC_FLAGS=\"--no-ipc\"/" ./scripts/tests.sh
63 for i in ./scripts/*.sh ./scripts/*.py ./test/*.sh; do
66 TERM=xterm ./scripts/tests.sh
71 description = "Compiler for Ethereum smart contract language Solidity";
72 homepage = "https://github.com/ethereum/solidity";
73 license = licenses.gpl3;
74 platforms = with platforms; linux; # darwin is currently broken
75 maintainers = with maintainers; [ dbrock akru lionello sifmelcara ];