forked from dapphub/dapptools
-
Notifications
You must be signed in to change notification settings - Fork 3
/
overlay.nix
118 lines (96 loc) · 3.65 KB
/
overlay.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
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
self: super:
let
lib = self.pkgs.lib;
stdenv = self.pkgs.stdenv;
in rec {
dapptoolsSrc = self.callPackage (import ./nix/dapptools-src.nix) {};
haskellPackages = super.haskellPackages.override (old: {
overrides = lib.composeExtensions (old.overrides or (_: _: {})) (
import ./haskell.nix { inherit lib; pkgs = self; }
);
});
solidityPackage = import ./nix/solidity-package.nix {
inherit (self) pkgs;
};
# experimental dapp builder, allows for easy overriding of phases
buildDappPackage = import ./nix/build-dapp-package.nix { inherit (self) pkgs; };
# Here we can make e.g. integration tests for Dappsys.
dapp-tests = import ./src/dapp-tests { inherit (self) pkgs; };
# These are tests that verify the correctness of hevm symbolic using various
# external test suites (e.g. the solc tests)
hevm-tests = import ./nix/hevm-tests { pkgs = self.pkgs; };
bashScript = { name, version ? "0", deps ? [], text, check ? true } :
self.pkgs.writeTextFile {
name = "${name}-${version}";
executable = true;
destination = "/bin/${name}";
text = ''
#!${self.pkgs.bash}/bin/bash
set -euo pipefail
shopt -s lastpipe
export PATH="${lib.makeBinPath deps}:/run/wrappers/bin"
${text}
'';
checkPhase = ''
${self.pkgs.bash}/bin/bash -n $out/bin/${name}
'' + (if check then ''
${self.pkgs.shellcheck}/bin/shellcheck -s bash $out/bin/${name}
'' else "");
};
dapp2 = {
test-hevm = import ./nix/dapp/dapp-test-hevm.nix { pkgs = self.pkgs; };
};
solc-versions =
let
fetchSolcVersions = { owner, attr }:
super.lib.mapAttrs
(_: nixpkgs: (importNixpkgs { inherit owner; inherit (nixpkgs) rev sha256; }).solc)
(builtins.getAttr attr (import ./nix/solc-versions.nix));
importNixpkgs = { owner, rev, sha256 }:
import (self.pkgs.fetchFromGitHub {
inherit owner rev sha256;
repo = "nixpkgs";
}) {};
in
fetchSolcVersions { owner = "NixOS"; attr = super.system; }
//
fetchSolcVersions { owner = "dapphub"; attr = "unreleased_" + super.system; };
solc = solc-versions.solc_0_6_7;
hevm = self.pkgs.haskell.lib.justStaticExecutables self.haskellPackages.hevm;
libff = self.callPackage (import ./nix/libff.nix) {};
cvc4 = self.callPackage (import ./nix/cvc4.nix) {};
jays = (
self.pkgs.haskell.lib.justStaticExecutables
(self.haskellPackages.callCabal2nix "jays" (./src/jays) {})
).overrideAttrs (_: { postInstall = "cp $out/bin/{jays,jshon}"; });
# Override buggy jshon program with Haskell-based replacement.
jshon = self.jays;
seth = self.callPackage (import ./src/seth) {};
dapp = self.callPackage (import ./src/dapp) {};
ethsign = (self.callPackage (import ./src/ethsign) {});
token = self.callPackage (import ./src/token) {};
# We use this to run private testnets without
# the pesky transaction size limit.
go-ethereum-unlimited = self.callPackage (import ./src/go-ethereum-statediff) {};
qrtx = self.bashScript {
name = "qrtx";
version = "0";
deps = with self.pkgs; [qrencode feh vim gnused coreutils];
text = ''
sed 's/^0x//' | tr -d '[:space:]' | xxd -r -p | base64 -w0 |
qrencode -s 1 -o - | feh -ZB white --force-aliasing -
'';
};
qrtx-term = self.bashScript {
name = "qrtx-term";
version = "0";
deps = with self.pkgs; [qrencode vim gnused coreutils];
text = ''
sed 's/^0x//' | tr -d '[:space:]' | xxd -r -p | base64 -w0 |
qrencode -t ANSIUTF8
'';
};
secp256k1 = super.secp256k1.overrideDerivation (_: {
dontDisableStatic = true;
});
}