nixpkgs/pkgs/by-name/so/solana-cli/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

115 lines
3.2 KiB
Nix
Raw Normal View History

{ stdenv
, fetchFromGitHub
, lib
, rustPlatform
, darwin
, udev
, protobuf
, libcxx
, rocksdb_8_3
2024-04-11 08:08:00 +00:00
, installShellFiles
, pkg-config
, openssl
, nix-update-script
2024-04-11 08:08:00 +00:00
# Taken from https://github.com/solana-labs/solana/blob/master/scripts/cargo-install-all.sh#L84
, solanaPkgs ? [
"solana"
"solana-bench-tps"
"solana-faucet"
"solana-gossip"
"solana-install"
"solana-keygen"
2024-01-13 16:35:12 +00:00
"solana-ledger-tool"
"solana-log-analyzer"
"solana-net-shaper"
"solana-validator"
2024-04-03 19:46:10 +00:00
"solana-test-validator"
2024-04-11 08:08:00 +00:00
] ++ [
# XXX: Ensure `solana-genesis` is built LAST!
# See https://github.com/solana-labs/solana/issues/5826
"solana-genesis"
]
}:
2022-04-21 02:18:33 +00:00
let
2024-04-19 19:20:07 +00:00
version = "1.17.31";
sha256 = "sha256-5qPW199o+CVJlqGwiAegsquBRWEb5uDKITxjN5dQYAQ=";
rocksdb = rocksdb_8_3;
inherit (darwin.apple_sdk_11_0) Libsystem;
inherit (darwin.apple_sdk_11_0.frameworks) System IOKit AppKit Security;
2022-04-21 02:18:33 +00:00
in
rustPlatform.buildRustPackage rec {
pname = "solana-cli";
2024-01-13 16:35:12 +00:00
inherit version;
src = fetchFromGitHub {
owner = "solana-labs";
repo = "solana";
rev = "v${version}";
2022-04-21 02:18:33 +00:00
inherit sha256;
};
2024-01-13 16:35:12 +00:00
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"crossbeam-epoch-0.9.5" = "sha256-Jf0RarsgJiXiZ+ddy0vp4jQ59J9m0k3sgXhWhCdhgws=";
2024-04-03 19:46:10 +00:00
"tokio-1.29.1" = "sha256-Z/kewMCqkPVTXdoBcSaFKG5GSQAdkdpj3mAzLLCjjGk=";
2024-01-13 16:35:12 +00:00
};
};
strictDeps = true;
cargoBuildFlags = builtins.map (n: "--bin=${n}") solanaPkgs;
# Even tho the tests work, a shit ton of them try to connect to a local RPC
# or access internet in other ways, eventually failing due to Nix sandbox.
# Maybe we could restrict the check to the tests that don't require an RPC,
# but judging by the quantity of tests, that seems like a lengthty work and
# I'm not in the mood ((ΦωΦ))
doCheck = false;
2024-04-11 08:08:00 +00:00
nativeBuildInputs = [ installShellFiles protobuf pkg-config ];
buildInputs = [ openssl rustPlatform.bindgenHook ]
2024-04-11 08:08:00 +00:00
++ lib.optionals stdenv.isLinux [ udev ]
++ lib.optionals stdenv.isDarwin [
libcxx
IOKit
Security
AppKit
System
Libsystem
];
postInstall = ''
2024-04-11 08:08:00 +00:00
installShellCompletion --cmd solana \
--bash <($out/bin/solana completion --shell bash) \
--fish <($out/bin/solana completion --shell fish) \
--zsh <($out/bin/solana completion --shell zsh)
mkdir -p $out/bin/sdk/bpf
cp -a ./sdk/bpf/* $out/bin/sdk/bpf/
'';
# Used by build.rs in the rocksdb-sys crate. If we don't set these, it would
# try to build RocksDB from source.
2024-04-11 08:08:00 +00:00
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
# Require this on darwin otherwise the compiler starts rambling about missing
# cmath functions
2024-04-11 08:08:00 +00:00
CPPFLAGS = lib.optionals stdenv.isDarwin "-isystem ${lib.getDev libcxx}/include/c++/v1";
LDFLAGS = lib.optionals stdenv.isDarwin "-L${lib.getLib libcxx}/lib";
# If set, always finds OpenSSL in the system, even if the vendored feature is enabled.
OPENSSL_NO_VENDOR = 1;
meta = with lib; {
2024-04-11 08:08:00 +00:00
description = "Web-Scale Blockchain for fast, secure, scalable, decentralized apps and marketplaces";
homepage = "https://solana.com";
license = licenses.asl20;
2024-01-13 16:35:12 +00:00
maintainers = with maintainers; [ netfox happysalada aikooo7 ];
platforms = platforms.unix;
};
passthru.updateScript = nix-update-script { };
}