Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and simplify Nix build #581

Merged
merged 2 commits into from
Jan 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 7 additions & 35 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{ nixpkgs ? import ./nix/dapptools.nix, compiler ? "default", doBenchmark ? false }:
{ pkgs ? import <nixpkgs> {} }:

let
inherit (nixpkgs) pkgs;

v = "1.5.0";

crytic-compile = pkgs.python3Packages.callPackage (import ./nix/crytic-compile.nix) {};
v = "1.6.0";

f = { mkDerivation, aeson, ansi-terminal, base, base16-bytestring
, binary, brick, bytestring, cborg, containers, data-dword, data-has
Expand All @@ -15,7 +11,7 @@ let
, 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
, cabal-install, extra, ListLike, hlint
}:
mkDerivation rec {
pname = "echidna";
Expand All @@ -29,14 +25,13 @@ let
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
vector-instances vty wl-pprint-annotated word8 yaml extra ListLike
] ++ (if pkgs.lib.inNixShell then testHaskellDepends else []);
libraryToolDepends = [ hpack cabal-install ];
libraryToolDepends = [ hpack cabal-install hlint ];
executableHaskellDepends = libraryHaskellDepends;
testHaskellDepends = [
tasty tasty-hunit tasty-quickcheck
];
executableSystemDepends = [ crytic-compile pkgs.solc-versions.solc_0_5_15 ];
preConfigure = ''
hpack
# re-enable dynamic build for Linux
Expand All @@ -48,31 +43,8 @@ let
doCheck = false;
};

haskellPackages = if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};

# extra from dapptools is outdated, override
extra = pkgs.haskellPackages.callCabal2nix "extra" (builtins.fetchGit {
url = "https://github.com/ndmitchell/extra";
rev = "24dd03b2073860553cd37ac3064cf7e95c7feff9"; # 1.17.1
}) {};

haskellPackages' = haskellPackages.extend (self: super: { inherit extra; } );

variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;

drv = variant (haskellPackages'.callPackage f {});
drv = pkgs.haskellPackages.callPackage f { };
in
if pkgs.lib.inNixShell
then drv.env
else pkgs.symlinkJoin {
name = "echidna-${v}-with-deps";
paths = [ (pkgs.haskell.lib.justStaticExecutables drv) ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/echidna-test \
--prefix PATH : ${pkgs.lib.makeBinPath [ crytic-compile ]} \
--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.solc-versions.solc_0_5_15 ]}
'';
}
else pkgs.haskell.lib.justStaticExecutables drv
15 changes: 0 additions & 15 deletions nix/crytic-compile.nix

This file was deleted.

5 changes: 0 additions & 5 deletions nix/dapptools.nix

This file was deleted.