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

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

66 lines
2.0 KiB
Nix
Raw Normal View History

2020-09-25 23:41:01 +00:00
{ clang
2018-12-05 14:10:31 +00:00
, fetchFromGitHub
2020-09-25 23:41:01 +00:00
, lib
, llvmPackages
, protobuf
2018-12-05 14:10:31 +00:00
, rustPlatform
2022-04-03 15:22:08 +00:00
, stdenv
, writeShellScriptBin
2022-03-29 14:33:10 +00:00
, Security
2018-12-05 14:10:31 +00:00
}:
rustPlatform.buildRustPackage rec {
2019-08-31 11:41:23 +00:00
pname = "polkadot";
2022-09-16 01:17:05 +00:00
version = "0.9.29";
2018-12-05 14:10:31 +00:00
src = fetchFromGitHub {
owner = "paritytech";
2020-09-25 23:41:01 +00:00
repo = "polkadot";
rev = "v${version}";
2022-09-16 01:17:05 +00:00
sha256 = "sha256-/IJs3153KzhGf5I6LueljzRhDl/PYYlPseF6wCh+u3M=";
2022-03-21 18:18:11 +00:00
# the build process of polkadot requires a .git folder in order to determine
# the git commit hash that is being built and add it to the version string.
# since having a .git folder introduces reproducibility issues to the nix
# build, we check the git commit hash after fetching the source and save it
# into a .git_commit file, and then delete the .git folder. we can then use
# this file to populate an environment variable with the commit hash, which
# is picked up by polkadot's build process.
leaveDotGit = true;
postFetch = ''
( cd $out; git rev-parse --short HEAD > .git_commit )
rm -rf $out/.git
'';
};
2022-09-16 01:17:05 +00:00
cargoSha256 = "sha256-mI8VvTlM9ynstDBC0ubQkzg3D2ZXuWqJGS/Y23D6dU0=";
2022-03-21 18:18:11 +00:00
2022-04-03 15:22:08 +00:00
buildInputs = lib.optional stdenv.isDarwin [ Security ];
2022-03-29 14:33:10 +00:00
2022-03-21 18:18:11 +00:00
nativeBuildInputs = [ clang ];
2020-09-25 23:41:01 +00:00
2022-03-21 18:18:11 +00:00
preBuild = ''
export SUBSTRATE_CLI_GIT_COMMIT_HASH=$(cat .git_commit)
rm .git_commit
'';
2020-09-25 23:41:01 +00:00
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
2020-09-25 23:41:01 +00:00
PROTOC = "${protobuf}/bin/protoc";
# NOTE: We don't build the WASM runtimes since this would require a more
2021-01-22 17:16:14 +00:00
# complicated rust environment setup and this is only needed for developer
# environments. The resulting binary is useful for end-users of live networks
# since those just use the WASM blob from the network chainspec.
SKIP_WASM_BUILD = 1;
2018-12-05 14:10:31 +00:00
2020-09-25 23:41:01 +00:00
# We can't run the test suite since we didn't compile the WASM runtimes.
doCheck = false;
2018-12-05 14:10:31 +00:00
2020-09-25 23:41:01 +00:00
meta = with lib; {
2018-12-05 14:10:31 +00:00
description = "Polkadot Node Implementation";
homepage = "https://polkadot.network";
2021-03-06 02:30:43 +00:00
license = licenses.gpl3Only;
maintainers = with maintainers; [ akru andresilva asymmetric FlorianFranzen RaghavSood ];
2022-03-29 14:33:10 +00:00
platforms = platforms.unix;
2018-12-05 14:10:31 +00:00
};
}