-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathshell.nix
120 lines (105 loc) · 3.09 KB
/
shell.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
119
120
{pkgs, isCrib}:
with pkgs; let
go = go_1_23;
postgresql = postgresql_15;
nodejs = nodejs-18_x;
nodePackages = pkgs.nodePackages.override {inherit nodejs;};
pnpm = pnpm_9;
version = "v2.0.18";
getBinDerivation =
{
name,
filename,
sha256,
}:
pkgs.stdenv.mkDerivation rec {
inherit name;
url = "https://github.com/anza-xyz/agave/releases/download/${version}/${filename}";
nativeBuildInputs = [
autoPatchelfHook
];
autoPatchelfIgnoreMissingDeps = true;
buildInputs = with pkgs; [stdenv.cc.cc.libgcc stdenv.cc.cc.lib] ++ lib.optionals stdenv.isLinux [ libudev-zero ];
src = pkgs.fetchzip {
inherit url sha256;
};
installPhase = ''
mkdir -p $out/bin
ls -lah $src
cp -r $src/bin/* $out/bin
'';
};
solanaBinaries = {
x86_64-linux = getBinDerivation {
name = "solana-cli-x86_64-linux";
filename = "solana-release-x86_64-unknown-linux-gnu.tar.bz2";
### BEGIN_LINUX_SHA256 ###
sha256 = "sha256-3FW6IMZeDtyU4GTsRIwT9BFLNzLPEuP+oiQdur7P13s=";
### END_LINUX_SHA256 ###
};
aarch64-apple-darwin = getBinDerivation {
name = "solana-cli-aarch64-apple-darwin";
filename = "solana-release-aarch64-apple-darwin.tar.bz2";
### BEGIN_DARWIN_SHA256 ###
sha256 = "sha256-6VjycYU0NU0evXoqtGAZMYGHQEKijofnFQnBJNVsb6Q=";
### END_DARWIN_SHA256 ###
};
};
mkShell' = mkShell.override {
# The current nix default sdk for macOS fails to compile go projects, so we use a newer one for now.
stdenv =
if stdenv.isDarwin
then overrideSDK stdenv "11.0"
else stdenv;
};
in
mkShell' {
nativeBuildInputs =
[
go
postgresql
python3
python3Packages.pip
protobuf
protoc-gen-go
protoc-gen-go-grpc
foundry-bin
curl
nodejs
pnpm
# TODO: compiler / gcc for secp compilation
go-ethereum # geth
go-mockery
# tooling
gotools
gopls
delve
golangci-lint
github-cli
jq
# gofuzz
]
++ lib.optionals stdenv.isLinux [
# some dependencies needed for node-gyp on pnpm install
pkg-config
libudev-zero
libusb1
solanaBinaries.x86_64-linux
] ++ lib.optionals isCrib [
nur.repos.goreleaser.goreleaser-pro
patchelf
] ++ pkgs.lib.optionals (pkgs.stdenv.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) [
solanaBinaries.aarch64-apple-darwin
];
shellHook = ''
${if !isCrib then "" else ''
if [ -z $GORELEASER_KEY ]; then
echo "GORELEASER_KEY must be set in CRIB environments. You can find it in our 1p vault under 'goreleaser-pro-license'."
exit 1
fi
${if stdenv.isDarwin then "source $(git rev-parse --show-toplevel)/nix-darwin-shell-hook.sh" else ""}
''}
'';
PGDATA = "db";
CL_DATABASE_URL = "postgresql://chainlink:chainlink@localhost:5432/chainlink_test?sslmode=disable";
}