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

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

71 lines
2.2 KiB
Nix
Raw Normal View History

2023-03-29 09:36:02 +00:00
{ fetchFromGitHub
2020-09-25 23:41:01 +00:00
, lib
, protobuf
2023-01-24 10:10:14 +00:00
, rocksdb
2018-12-05 14:10:31 +00:00
, rustPlatform
2022-04-03 15:22:08 +00:00
, stdenv
2022-03-29 14:33:10 +00:00
, Security
2023-01-23 12:42:20 +00:00
, SystemConfiguration
2018-12-05 14:10:31 +00:00
}:
rustPlatform.buildRustPackage rec {
2019-08-31 11:41:23 +00:00
pname = "polkadot";
2023-06-23 09:26:27 +00:00
version = "0.9.43";
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}";
2023-06-23 09:26:27 +00:00
hash = "sha256-h+9b+KQgdYowHYGr0nPsqibcwOPmBVo9tKi/uEbLhqo=";
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
'';
};
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
2023-06-23 09:26:27 +00:00
"binary-merkle-tree-4.0.0-dev" = "sha256-/8bGqnM/yqtCgVWkIaVEySZSV3XGYuiA3JuyHYTp2lw=";
"sub-tokens-0.1.0" = "sha256-GvhgZhOIX39zF+TbQWtTCgahDec4lQjH+NqamLFLUxM=";
};
};
2022-03-21 18:18:11 +00:00
2023-01-23 12:42:20 +00:00
buildInputs = lib.optionals stdenv.isDarwin [ Security SystemConfiguration ];
2022-03-29 14:33:10 +00:00
nativeBuildInputs = [ rustPlatform.bindgenHook ];
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
PROTOC = "${protobuf}/bin/protoc";
2023-01-24 10:10:14 +00:00
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
2020-09-25 23:41:01 +00:00
# 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
};
}