Alyssa Ross 63bff8c132
treewide: migrate to fetchCargoVendor, batch 1
Cargo 1.84.0 seems to have changed the output format of cargo vendor
again, once again invalidating fetchCargoTarball FOD hashes.  It's
time to fix this once and for all, switching across the board to
fetchCargoVendor, which is not dependent on cargo vendor's output
format.

It should be possible to reproduce this diff.  To do so, get the list
of files changed by this commit, e.g. with git diff --name-only, then
run the following two commands, each with that list of files as their
standard input:

	xargs sed -i 's/^\(. *\)\(cargoHash\)\b/\1useFetchCargoVendor = true;\n\1cargoHash/'
	cut -d / -f 4 | xargs -n 1 nix-update --version=skip

This will take a long time.  It might be possible to parallelize it
using xargs' -P option.  I haven't tested it.
2025-01-23 11:46:43 +01:00

67 lines
1.6 KiB
Nix

{
rustPlatform,
lib,
fetchFromGitHub,
zlib,
openssl,
pkg-config,
protobuf,
}:
rustPlatform.buildRustPackage rec {
pname = "nearcore";
version = "1.30.1";
# https://github.com/near/nearcore/tags
src = fetchFromGitHub {
owner = "near";
repo = "nearcore";
# there is also a branch for this version number, so we need to be explicit
tag = version;
sha256 = "sha256-VjvHCiWjsx5Y7xxqck/O9gSNrL8mxCTosLwLqC85ywY=";
};
useFetchCargoVendor = true;
cargoHash = "sha256-3MvUn6CJ3skVctTIYhib8G+UVOB/VXokwlTnseGJAGU=";
cargoPatches = [ ./0001-make-near-test-contracts-optional.patch ];
postPatch = ''
substituteInPlace neard/build.rs \
--replace 'get_git_version()?' '"nix:${version}"'
'';
CARGO_PROFILE_RELEASE_CODEGEN_UNITS = "1";
CARGO_PROFILE_RELEASE_LTO = "fat";
NEAR_RELEASE_BUILD = "release";
OPENSSL_NO_VENDOR = 1; # we want to link to OpenSSL provided by Nix
# don't build SDK samples that require wasm-enabled rust
buildAndTestSubdir = "neard";
doCheck = false; # needs network
buildInputs = [
zlib
openssl
];
nativeBuildInputs = [
pkg-config
protobuf
rustPlatform.bindgenHook
];
# fat LTO requires ~3.4GB RAM
requiredSystemFeatures = [ "big-parallel" ];
meta = with lib; {
description = "Reference client for NEAR Protocol";
homepage = "https://github.com/near/nearcore";
license = licenses.gpl3;
maintainers = with maintainers; [ mikroskeem ];
# only x86_64 is supported in nearcore because of sse4+ support, macOS might
# be also possible
platforms = [ "x86_64-linux" ];
};
}