Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 65 lines 1.6 kB view raw
1{ 2 rustPlatform, 3 lib, 4 fetchFromGitHub, 5 zlib, 6 openssl, 7 pkg-config, 8 protobuf, 9}: 10rustPlatform.buildRustPackage rec { 11 pname = "nearcore"; 12 version = "1.30.1"; 13 14 # https://github.com/near/nearcore/tags 15 src = fetchFromGitHub { 16 owner = "near"; 17 repo = "nearcore"; 18 # there is also a branch for this version number, so we need to be explicit 19 tag = version; 20 21 sha256 = "sha256-VjvHCiWjsx5Y7xxqck/O9gSNrL8mxCTosLwLqC85ywY="; 22 }; 23 24 cargoHash = "sha256-3MvUn6CJ3skVctTIYhib8G+UVOB/VXokwlTnseGJAGU="; 25 cargoPatches = [ ./0001-make-near-test-contracts-optional.patch ]; 26 27 postPatch = '' 28 substituteInPlace neard/build.rs \ 29 --replace 'get_git_version()?' '"nix:${version}"' 30 ''; 31 32 CARGO_PROFILE_RELEASE_CODEGEN_UNITS = "1"; 33 CARGO_PROFILE_RELEASE_LTO = "fat"; 34 NEAR_RELEASE_BUILD = "release"; 35 36 OPENSSL_NO_VENDOR = 1; # we want to link to OpenSSL provided by Nix 37 38 # don't build SDK samples that require wasm-enabled rust 39 buildAndTestSubdir = "neard"; 40 doCheck = false; # needs network 41 42 buildInputs = [ 43 zlib 44 openssl 45 ]; 46 47 nativeBuildInputs = [ 48 pkg-config 49 protobuf 50 rustPlatform.bindgenHook 51 ]; 52 53 # fat LTO requires ~3.4GB RAM 54 requiredSystemFeatures = [ "big-parallel" ]; 55 56 meta = with lib; { 57 description = "Reference client for NEAR Protocol"; 58 homepage = "https://github.com/near/nearcore"; 59 license = licenses.gpl3; 60 maintainers = with maintainers; [ mikroskeem ]; 61 # only x86_64 is supported in nearcore because of sse4+ support, macOS might 62 # be also possible 63 platforms = [ "x86_64-linux" ]; 64 }; 65}