about summary refs log tree commit diff
path: root/pkgs/applications/blockchains/polkadot
diff options
context:
space:
mode:
authorAndré Silva <andrerfosilva@gmail.com>2022-03-21 18:18:11 +0000
committerAndré Silva <andrerfosilva@gmail.com>2022-03-21 18:19:00 +0000
commit214be243c9c4d2ac1ff1dafeb2a58745186c28ce (patch)
tree4d1cfaf34a08a59cb96b57e8b86a4c7efcb298d8 /pkgs/applications/blockchains/polkadot
parent03891bb4bb296508e3834f47bb2faf1f3af0f546 (diff)
downloadnixlib-214be243c9c4d2ac1ff1dafeb2a58745186c28ce.tar
nixlib-214be243c9c4d2ac1ff1dafeb2a58745186c28ce.tar.gz
nixlib-214be243c9c4d2ac1ff1dafeb2a58745186c28ce.tar.bz2
nixlib-214be243c9c4d2ac1ff1dafeb2a58745186c28ce.tar.lz
nixlib-214be243c9c4d2ac1ff1dafeb2a58745186c28ce.tar.xz
nixlib-214be243c9c4d2ac1ff1dafeb2a58745186c28ce.tar.zst
nixlib-214be243c9c4d2ac1ff1dafeb2a58745186c28ce.zip
polkadot: 0.9.17 -> 0.9.18
Diffstat (limited to 'pkgs/applications/blockchains/polkadot')
-rw-r--r--pkgs/applications/blockchains/polkadot/default.nix42
1 files changed, 17 insertions, 25 deletions
diff --git a/pkgs/applications/blockchains/polkadot/default.nix b/pkgs/applications/blockchains/polkadot/default.nix
index e008832d4f07..ced8b1f857cc 100644
--- a/pkgs/applications/blockchains/polkadot/default.nix
+++ b/pkgs/applications/blockchains/polkadot/default.nix
@@ -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=";
-
-    # see the comment below on fakeGit for how this is used
+    sha256 = "sha256-pjHSiVspBV15jKUFv+Uf2l3tah40l55Pv8vwDuwgwjc=";
+
+    # 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 = [ clang ];
 
-  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 ];
+  preBuild = ''
+    export SUBSTRATE_CLI_GIT_COMMIT_HASH=$(cat .git_commit)
+    rm .git_commit
+  '';
 
   LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
   PROTOC = "${protobuf}/bin/protoc";