1 # largely inspired from https://github.com/saber-hq/saber-overlay/blob/master/packages/solana/solana.nix
34 "solana-stake-accounts"
35 "solana-test-validator"
39 # XXX: Ensure `solana-genesis` is built LAST!
40 # See https://github.com/solana-labs/solana/issues/5826
45 pinData = lib.importJSON ./pin.json;
46 version = pinData.version;
48 rocksdb = rocksdb_8_3;
49 inherit (darwin.apple_sdk_11_0) Libsystem;
50 inherit (darwin.apple_sdk_11_0.frameworks) System IOKit AppKit Security;
52 rustPlatform.buildRustPackage rec {
53 pname = "solana-validator";
56 src = fetchFromGitHub {
57 owner = "solana-labs";
64 lockFile = ./Cargo.lock;
66 "crossbeam-epoch-0.9.5" = "sha256-Jf0RarsgJiXiZ+ddy0vp4jQ59J9m0k3sgXhWhCdhgws=";
67 "tokio-1.29.1" = "sha256-Z/kewMCqkPVTXdoBcSaFKG5GSQAdkdpj3mAzLLCjjGk=";
71 cargoBuildFlags = builtins.map (n: "--bin=${n}") solanaPkgs;
73 # weird errors. see https://github.com/NixOS/nixpkgs/issues/52447#issuecomment-852079285
74 # LLVM_CONFIG_PATH = "${llvm}/bin/llvm-config";
76 nativeBuildInputs = [ pkg-config protobuf rustfmt perl rustPlatform.bindgenHook ];
78 [ openssl zlib libclang hidapi ] ++ (lib.optionals stdenv.hostPlatform.isLinux [ udev ])
79 ++ lib.optionals stdenv.hostPlatform.isDarwin [ Security System Libsystem libcxx ];
85 # Used by build.rs in the rocksdb-sys crate. If we don't set these, it would
86 # try to build RocksDB from source.
87 ROCKSDB_LIB_DIR = "${lib.getLib rocksdb}/lib";
89 # If set, always finds OpenSSL in the system, even if the vendored feature is enabled.
90 OPENSSL_NO_VENDOR = "1";
91 } // lib.optionalAttrs stdenv.hostPlatform.isDarwin {
92 # Require this on darwin otherwise the compiler starts rambling about missing
94 CPPFLAGS = "-isystem ${lib.getDev libcxx}/include/c++/v1";
95 LDFLAGS = "-L${lib.getLib libcxx}/lib";
99 description = "Web-Scale Blockchain for fast, secure, scalable, decentralized apps and marketplaces.";
100 homepage = "https://solana.com";
101 license = licenses.asl20;
102 maintainers = with maintainers; [ adjacentresearch ];
103 platforms = platforms.unix;
105 passthru.updateScript = ./update.sh;