Merge pull request #165143 from andresilva/andre/polkadot-0.9.18
This commit is contained in:
commit
aeadc86174
1 changed files with 16 additions and 24 deletions
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue