This repository has been archived by the owner on May 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
neard.nix
76 lines (65 loc) · 1.69 KB
/
neard.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{ fetchFromGitHub
, stdenv
, lib
, clang
, llvm
, llvmPackages
, openssl
, perl
, pkg-config
, protobuf
, rustPlatform
, CoreFoundation
, DiskArbitration
, Foundation
, IOKit
, Security
, features ? [ ]
}:
rustPlatform.buildRustPackage rec {
pname = "neard";
version = "1.36.1";
buildInputs = [
llvm
llvmPackages.libclang.lib
openssl
] ++ lib.optionals stdenv.isDarwin [
CoreFoundation
DiskArbitration
Foundation
IOKit
Security
];
nativeBuildInputs = [ clang llvm.out perl pkg-config protobuf ];
OPENSSL_NO_VENDOR = 1; # we want to link to OpenSSL provided by Nix
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
buildAndTestSubdir = "neard";
src = fetchFromGitHub {
owner = "near";
repo = "nearcore";
rev = "refs/tags/${version}";
hash = "sha256-SNR7WgnUnzPLMYKtcda1fZQuj3ETSjhJMrbygThlZ0o=";
};
cargoPatches = [ ./patches/1.36.1/0001-Make-near-test-contracts-optional.patch ];
cargoHash = "sha256-8D1gLl/rPm0piCnUqLfzR21Rr76mQJptkcrKQo8CEQ4=";
postPatch = ''
substituteInPlace neard/build.rs \
--replace 'get_git_version()?' '"zentria-nix:${version}"'
'';
CARGO_PROFILE_RELEASE_CODEGEN_UNITS = "1";
CARGO_PROFILE_RELEASE_LTO = "thin";
RUSTFLAGS = "-D warnings";
NEAR_RELEASE_BUILD = "release";
cargoBuildFlags = lib.optional (features != [ ]) "--features=${lib.concatStringsSep "," features}";
doCheck = false; # tests only few CLI things
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/neard --version
runHook postInstallCheck
'';
meta = with lib; {
platforms = platforms.linux ++ platforms.darwin;
broken = stdenv.isAarch64 && !stdenv.isDarwin;
};
}