about summary refs log tree commit diff
path: root/pkgs/applications/blockchains
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2022-05-19 09:16:45 +0100
committerGitHub <noreply@github.com>2022-05-19 09:16:45 +0100
commit04278f69e294fb16583a698d5b6aa26f2191b097 (patch)
treedb6ae53771f935c56a28cc6600feac5154abe03e /pkgs/applications/blockchains
parent83d3be5302d22e4b6961dea11cd21f995b2eae30 (diff)
parent3eac5383b103b82dd27d2a6f3cf2067de44d8dff (diff)
Merge pull request #172550 from Mic92/nearcore
nearcore: 1.25.0 -> 1.26.0
Diffstat (limited to 'pkgs/applications/blockchains')
-rw-r--r--pkgs/applications/blockchains/nearcore/default.nix46
1 files changed, 32 insertions, 14 deletions
diff --git a/pkgs/applications/blockchains/nearcore/default.nix b/pkgs/applications/blockchains/nearcore/default.nix
index f9f0bd0c69bfb..264d53fc56a53 100644
--- a/pkgs/applications/blockchains/nearcore/default.nix
+++ b/pkgs/applications/blockchains/nearcore/default.nix
@@ -1,42 +1,60 @@
 { rustPlatform, lib, fetchFromGitHub
-, zlib, elfutils, openssl
-, cmake, python3, pkg-config, protobuf, perl, llvmPackages
+, zlib, openssl
+, pkg-config, protobuf, llvmPackages
 }:
 rustPlatform.buildRustPackage rec {
-  #https://github.com/near/nearcore
   pname = "nearcore";
-  version = "1.25.0";
+  version = "1.26.0";
+
+  # 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
     rev = "refs/tags/${version}";
-    sha256 = "sha256-7hiBqJLGIf+kNKJvMQ7KtGZm/SWLY3pT7YDlwbm3HDM=";
+    sha256 = "sha256-N3A+hy5I1/yJ3IN9gDw3m1IZ9qK8LNhn3fuXLMn23bg=";
   };
 
-  cargoSha256 = "sha256-EGv4CibSHL9oTAdWK7d/SOzZWPcEB16hTWlWHjKU4wc=";
+  cargoSha256 = "sha256-g07liit048TSL73wFyDK+eKu33Z6fPJcJ+VeGgTtuS8=";
+
+  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
-  cargoBuildFlags = [ "-p" "neard" ];
+  buildAndTestSubdir = "neard";
   doCheck = false; # needs network
 
-  buildInputs = [ zlib elfutils openssl ];
+  buildInputs = [
+    zlib
+    openssl
+  ];
+
   nativeBuildInputs = [
-    cmake
-    python3
     pkg-config
     protobuf
-    perl
   ];
 
+  # fat LTO requires ~3.4GB RAM
+  requiredSystemFeatures = [ "big-parallel" ];
+
   LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
   BINDGEN_EXTRA_CLANG_ARGS = "-isystem ${llvmPackages.libclang.lib}/lib/clang/${lib.getVersion llvmPackages.clang}/include";
 
   meta = with lib; {
     description = "Reference client for NEAR Protocol";
     homepage = "https://github.com/near/nearcore";
-    license = licenses.mit;
-    maintainers = with maintainers; [ mic92 ];
-    platforms = platforms.unix;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ mic92 mikroskeem ];
+    # only x86_64 is supported in nearcore because of sse4+ support, macOS might
+    # be also possible
+    platforms = [ "x86_64-linux" ];
   };
 }