@@ -0,0 +1,56 @@
1+{ stdenv
2+, fetchFromGitHub
3+, lib
4+, rustPlatform
5+, IOKit
6+, Security
7+, AppKit
8+, pkg-config
9+, udev
10+, zlib
11+, protobuf
12+}:
13+rustPlatform.buildRustPackage rec {
14+ pname = "solana-testnet-cli";
15+ version = "1.9.2";
16+
17+ src = fetchFromGitHub {
18+ owner = "solana-labs";
19+ repo = "solana";
20+ rev = "v${version}";
21+ sha256 = "sha256-wrv35vBohLztMZPb6gfZdCaXcjj/Y7vnQqINaI6dBM4=";
22+ };
23+
24+ cargoSha256 = "sha256-A5uVa+cRmrkVyw7MFH4QAr0VIFi18wcc2VPFvQyT9EM=";
25+
26+ buildAndTestSubdir = "cli";
27+
28+ nativeBuildInputs = lib.optionals stdenv.isLinux [ protobuf pkg-config ];
29+ buildInputs = lib.optionals stdenv.isLinux [ udev zlib ] ++ lib.optionals stdenv.isDarwin [ IOKit Security AppKit ];
30+
31+ # check phase fails
32+ # on darwin with missing framework System. This framework is not available in nixpkgs
33+ # on linux with some librocksdb-sys compilation error
34+ doCheck = false;
35+
36+ # all the following are needed for the checkphase
37+ # checkInputs = lib.optionals stdenv.isDarwin [ pkg-config rustfmt ];
38+ # Needed to get openssl-sys to use pkg-config.
39+ # OPENSSL_NO_VENDOR = 1;
40+ # OPENSSL_LIB_DIR = "${openssl.out}/lib";
41+ # OPENSSL_DIR="${lib.getDev openssl}";
42+ # LLVM_CONFIG_PATH="${llvm}/bin/llvm-config";
43+ # LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib";
44+ # Used by build.rs in the rocksdb-sys crate. If we don't set these, it would
45+ # try to build RocksDB from source.
46+ # ROCKSDB_INCLUDE_DIR="${rocksdb}/include";
47+ # ROCKSDB_LIB_DIR="${rocksdb}/lib";
48+
49+ meta = with lib; {
50+ description = "Web-Scale Blockchain for fast, secure, scalable, decentralized apps and marketplaces. ";
51+ homepage = "https://solana.com";
52+ license = licenses.asl20;
53+ maintainers = with maintainers; [ happysalada ];
54+ platforms = platforms.unix;
55+ };
56+}