Commit afa09e5e authored by Lorenz Leutgeb's avatar Lorenz Leutgeb
Browse files

radicle-node: Preserve Git commit hash and date



Co-authored-by: default avatarDefelo <mail@defelo.de>
Co-authored-by: default avatarMartin Joerg <martin.joerg@gmail.com>
parent 66d53b3e
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -25,7 +25,13 @@ rustPlatform.buildRustPackage rec {
  src = fetchgit {
    url = "https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git";
    rev = "refs/namespaces/z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM/refs/tags/v${version}";
    hash = "sha256-RB8yDfttVTkZmk01ubLkwrwD6IYo3Ehe7bPosJzoQk4=";
    hash = "sha256-AWgLhL6GslE3r2FcZu2imV5ZtEKlUD+a4C5waRGO2lM=";
    leaveDotGit = true;
    postFetch = ''
      git -C $out rev-parse HEAD > $out/.git_head
      git -C $out log -1 --pretty=%ct HEAD > $out/.git_time
      rm -rf $out/.git
    '';
  };
  useFetchCargoVendor = true;
  cargoHash = "sha256-/6VlRwWtJfHf6tXD2HJUTbThwTYeZFTJqtaxclrm3+c=";
@@ -37,6 +43,11 @@ rustPlatform.buildRustPackage rec {
  ];
  nativeCheckInputs = [ git ];

  preBuild = ''
    export GIT_HEAD=$(<$src/.git_head)
    export SOURCE_DATE_EPOCH=$(<$src/.git_time)
  '';

  # tests regularly time out on aarch64
  doCheck = stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86;