polkadot: 0.9.17 -> 0.9.18

This commit is contained in:
André Silva 2022-03-21 18:18:11 +00:00
parent 03891bb4bb
commit 214be243c9
No known key found for this signature in database
GPG Key ID: 7C34FA12A023DC55

View File

@ -8,15 +8,21 @@
}:
rustPlatform.buildRustPackage rec {
pname = "polkadot";
version = "0.9.17";
version = "0.9.18";
src = fetchFromGitHub {
owner = "paritytech";
repo = "polkadot";
rev = "v${version}";
sha256 = "sha256-m47Y4IXGc43XLs5d6ehlD0A53BWC5kO3K2BS/xbYgl8=";
sha256 = "sha256-pjHSiVspBV15jKUFv+Uf2l3tah40l55Pv8vwDuwgwjc=";
# see the comment below on fakeGit for how this is used
# 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 )
@ -24,28 +30,14 @@ rustPlatform.buildRustPackage rec {
'';
};
cargoSha256 = "sha256-JBacioy2woAfKQuK6tXU9as4DNc+3uY3F3GWksCf6WU=";
cargoSha256 = "sha256-Gc5WbayQUlsl7Fk8NyLPh2Zg2yrLl3WJqKorNZMLi94=";
nativeBuildInputs =
let
# 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. then we create a
# fake git command that will just return the contents of this file, which will
# be used when the polkadot build calls `git rev-parse` to fetch the commit
# hash.
fakeGit = writeShellScriptBin "git" ''
if [[ $@ = "rev-parse --short HEAD" ]]; then
cat /build/source/.git_commit
else
>&2 echo "Unknown command: $@"
exit 1
fi
'';
in
[ clang fakeGit ];
nativeBuildInputs = [ clang ];
preBuild = ''
export SUBSTRATE_CLI_GIT_COMMIT_HASH=$(cat .git_commit)
rm .git_commit
'';
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
PROTOC = "${protobuf}/bin/protoc";