nixpkgs/pkgs/applications/blockchains/nearcore/default.nix

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

61 lines
1.6 KiB
Nix
Raw Normal View History

2022-04-17 10:10:44 +00:00
{ rustPlatform, lib, fetchFromGitHub
2022-05-11 11:18:17 +00:00
, zlib, openssl
, pkg-config, protobuf, llvmPackages
2022-04-17 10:10:44 +00:00
}:
rustPlatform.buildRustPackage rec {
pname = "nearcore";
2023-02-07 03:29:16 +00:00
version = "1.30.1";
2022-05-11 11:18:17 +00:00
# https://github.com/near/nearcore/tags
2022-04-17 10:10:44 +00:00
src = fetchFromGitHub {
owner = "near";
repo = "nearcore";
# there is also a branch for this version number, so we need to be explicit
rev = "refs/tags/${version}";
2022-06-30 07:55:14 +00:00
2023-02-07 03:29:16 +00:00
sha256 = "sha256-VjvHCiWjsx5Y7xxqck/O9gSNrL8mxCTosLwLqC85ywY=";
2022-04-17 10:10:44 +00:00
};
2023-02-07 03:29:16 +00:00
cargoHash = "sha256-5Gs1sAzjuUO3IkwMX1NeA/Sbax0qtwvulyT66AQaNjs=";
2022-06-30 07:55:14 +00:00
cargoPatches = [ ./0001-make-near-test-contracts-optional.patch ];
2022-05-11 11:18:17 +00:00
postPatch = ''
substituteInPlace neard/build.rs \
--replace 'get_git_version()?' '"nix:${version}"'
'';
CARGO_PROFILE_RELEASE_CODEGEN_UNITS = "1";
2022-05-11 13:47:03 +00:00
CARGO_PROFILE_RELEASE_LTO = "fat";
2022-05-11 11:18:17 +00:00
NEAR_RELEASE_BUILD = "release";
OPENSSL_NO_VENDOR = 1; # we want to link to OpenSSL provided by Nix
2022-04-17 10:10:44 +00:00
# don't build SDK samples that require wasm-enabled rust
2022-05-11 11:18:17 +00:00
buildAndTestSubdir = "neard";
2022-04-17 10:10:44 +00:00
doCheck = false; # needs network
2022-05-11 11:18:17 +00:00
buildInputs = [
zlib
openssl
];
2022-04-17 10:10:44 +00:00
nativeBuildInputs = [
pkg-config
protobuf
rustPlatform.bindgenHook
2022-04-17 10:10:44 +00:00
];
2022-05-11 13:47:03 +00:00
# fat LTO requires ~3.4GB RAM
requiredSystemFeatures = [ "big-parallel" ];
2022-04-17 10:10:44 +00:00
meta = with lib; {
description = "Reference client for NEAR Protocol";
homepage = "https://github.com/near/nearcore";
2022-05-11 11:18:17 +00:00
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" ];
2022-04-17 10:10:44 +00:00
};
}