From 5481179b6ae1ceb13bdeea9eff9708c2ee9907ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 11 May 2022 13:18:17 +0200 Subject: [PATCH 1/4] nearcore: 1.25.0 -> 1.26.0 --- .../blockchains/nearcore/default.nix | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/pkgs/applications/blockchains/nearcore/default.nix b/pkgs/applications/blockchains/nearcore/default.nix index f9f0bd0c69b..99fce14eff9 100644 --- a/pkgs/applications/blockchains/nearcore/default.nix +++ b/pkgs/applications/blockchains/nearcore/default.nix @@ -1,32 +1,45 @@ { 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 = "thin"; + 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 ]; LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; @@ -35,7 +48,7 @@ rustPlatform.buildRustPackage rec { meta = with lib; { description = "Reference client for NEAR Protocol"; homepage = "https://github.com/near/nearcore"; - license = licenses.mit; + license = licenses.gpl3; maintainers = with maintainers; [ mic92 ]; platforms = platforms.unix; }; From bd41737ab4b4f26ade987b95679df8955dc37402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 11 May 2022 14:32:02 +0200 Subject: [PATCH 2/4] nearcore: mark as linux only for now macos support is feasible but requires some testing: https://github.com/ZentriaMC/neard-nix/blob/master/neard.nix#L23 --- pkgs/applications/blockchains/nearcore/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/blockchains/nearcore/default.nix b/pkgs/applications/blockchains/nearcore/default.nix index 99fce14eff9..09d4546356c 100644 --- a/pkgs/applications/blockchains/nearcore/default.nix +++ b/pkgs/applications/blockchains/nearcore/default.nix @@ -50,6 +50,8 @@ rustPlatform.buildRustPackage rec { homepage = "https://github.com/near/nearcore"; license = licenses.gpl3; maintainers = with maintainers; [ mic92 ]; - platforms = platforms.unix; + # only x86_64 is supported in nearcore because of sse4+ support, macOS might + # be also possible + platforms = [ "x86_64-linux" ]; }; } From 8d2b8d0da3814e7cec25fb31292e4ade6981cb7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 11 May 2022 15:47:03 +0200 Subject: [PATCH 3/4] nearcore: switch to fat lto --- pkgs/applications/blockchains/nearcore/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/blockchains/nearcore/default.nix b/pkgs/applications/blockchains/nearcore/default.nix index 09d4546356c..a5f9368b377 100644 --- a/pkgs/applications/blockchains/nearcore/default.nix +++ b/pkgs/applications/blockchains/nearcore/default.nix @@ -23,7 +23,7 @@ rustPlatform.buildRustPackage rec { ''; CARGO_PROFILE_RELEASE_CODEGEN_UNITS = "1"; - CARGO_PROFILE_RELEASE_LTO = "thin"; + CARGO_PROFILE_RELEASE_LTO = "fat"; NEAR_RELEASE_BUILD = "release"; OPENSSL_NO_VENDOR = 1; # we want to link to OpenSSL provided by Nix @@ -42,6 +42,9 @@ rustPlatform.buildRustPackage rec { protobuf ]; + # 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"; From 3eac5383b103b82dd27d2a6f3cf2067de44d8dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 13 May 2022 11:00:59 +0200 Subject: [PATCH 4/4] nearcore: add mikroskeem as a maintainer --- pkgs/applications/blockchains/nearcore/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/blockchains/nearcore/default.nix b/pkgs/applications/blockchains/nearcore/default.nix index a5f9368b377..264d53fc56a 100644 --- a/pkgs/applications/blockchains/nearcore/default.nix +++ b/pkgs/applications/blockchains/nearcore/default.nix @@ -52,7 +52,7 @@ rustPlatform.buildRustPackage rec { description = "Reference client for NEAR Protocol"; homepage = "https://github.com/near/nearcore"; license = licenses.gpl3; - maintainers = with maintainers; [ mic92 ]; + 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" ];