nixpkgs/pkgs/applications/blockchains/solana-validator/default.nix
Theodore Ni c06efc2173
solana-validator: adapt update script to new nix-prefetch-github
The update script is also already broken and needs:

1. Add missing packages to the shebang.
2. Retrieve cargo hash from the proper package.

We also take the opportunity to switch ot using the newer "hash" and
"cargoHash" properties.
2023-07-18 16:55:33 -07:00

85 lines
2.1 KiB
Nix

# largely inspired from https://github.com/saber-hq/saber-overlay/blob/master/packages/solana/solana.nix
{ stdenv
, fetchFromGitHub
, lib
, rustPlatform
, pkg-config
, udev
, zlib
, protobuf
, openssl
, libclang
, rustfmt
, perl
, hidapi
, solanaPkgs ? [
"solana"
"solana-bench-tps"
"solana-faucet"
"solana-gossip"
"solana-install"
"solana-keygen"
"solana-ledger-tool"
"solana-log-analyzer"
"solana-net-shaper"
"solana-sys-tuner"
"solana-validator"
"cargo-build-bpf"
"cargo-test-bpf"
"solana-dos"
"solana-install-init"
"solana-stake-accounts"
"solana-test-validator"
"solana-tokens"
"solana-watchtower"
] ++ [
# XXX: Ensure `solana-genesis` is built LAST!
# See https://github.com/solana-labs/solana/issues/5826
"solana-genesis"
]
}:
let
pinData = lib.importJSON ./pin.json;
version = pinData.version;
hash = pinData.hash;
cargoHash = pinData.cargoHash;
in
rustPlatform.buildRustPackage rec {
pname = "solana-validator";
inherit version;
src = fetchFromGitHub {
owner = "solana-labs";
repo = "solana";
rev = "v${version}";
inherit hash;
};
# partly inspired by https://github.com/obsidiansystems/solana-bridges/blob/develop/default.nix#L29
inherit cargoHash;
cargoBuildFlags = builtins.map (n: "--bin=${n}") solanaPkgs;
# weird errors. see https://github.com/NixOS/nixpkgs/issues/52447#issuecomment-852079285
# LLVM_CONFIG_PATH = "${llvm}/bin/llvm-config";
nativeBuildInputs = [ pkg-config protobuf rustfmt perl rustPlatform.bindgenHook ];
buildInputs =
[ openssl zlib libclang hidapi ] ++ (lib.optionals stdenv.isLinux [ udev ]);
strictDeps = true;
doCheck = false;
meta = with lib; {
description = "Web-Scale Blockchain for fast, secure, scalable, decentralized apps and marketplaces. ";
homepage = "https://solana.com";
license = licenses.asl20;
maintainers = with maintainers; [ adjacentresearch ];
platforms = platforms.unix;
# never built on aarch64-darwin, x86_64-darwin since first introduction in nixpkgs
broken = stdenv.isDarwin;
};
passthru.updateScript = ./update.sh;
}