-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathanchor-cli.nix
56 lines (48 loc) · 1.12 KB
/
anchor-cli.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
{ stdenv
, darwin
, fetchFromGitHub
, lib
, libgcc
, pkg-config
, protobuf
, rustPlatform
, makeWrapper
, solana-platform-tools
, udev
}:
rustPlatform.buildRustPackage rec {
pname = "anchor-cli";
version = "0.29.0";
doCheck = false;
nativeBuildInputs = [ protobuf pkg-config makeWrapper ];
buildInputs = [ ]
++ lib.optionals stdenv.isLinux [ udev ]
++ lib.optional
stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreFoundation
];
src = fetchFromGitHub {
owner = "coral-xyz";
repo = "anchor";
rev = "v${version}";
hash = "sha256-mftge1idALb4vwyF8wGo6qLmrnvCBK3l+Iw7txCyhDc=";
};
cargoLock = {
lockFile = "${src.outPath}/Cargo.lock";
allowBuiltinFetchGit = true;
};
buildAndTestSubdir = "cli";
patches = [
# Set default architecture to sbf instead of bpf
./anchor-cli.patch
];
# Ensure anchor has access to Solana's cargo and rust binaries
postInstall = ''
rust=${solana-platform-tools}/bin/sdk/sbf/dependencies/platform-tools/rust/bin
wrapProgram $out/bin/anchor \
--prefix PATH : "$rust"
'';
meta = {
description = "Anchor cli";
};
}