Commit 898be2ef authored by Robert Schütz's avatar Robert Schütz
Browse files

ccache: make src reproducible

parent a37a6e10
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -26,7 +26,20 @@ stdenv.mkDerivation (finalAttrs: {
    owner = "ccache";
    repo = "ccache";
    rev = "refs/tags/v${finalAttrs.version}";
    sha256 = "sha256-0T9iJXnDX8LffhB/5hsfBNyZQ211f0lL/7dvTrjmiE0=";
    # `git archive` replaces `$Format:%H %D$` in cmake/CcacheVersion.cmake
    # we need to replace it with something reproducible
    # see https://github.com/NixOS/nixpkgs/pull/316524
    postFetch = ''
      sed -i -E \
        's/version_info "([0-9a-f]{40}) .*(tag: v[^,]+).*"/version_info "\1 \2"/g w match' \
        $out/cmake/CcacheVersion.cmake
      if [ -s match ]; then
        rm match
      else # pattern didn't match
        exit 1
      fi
    '';
    hash = "sha256-YHSr2pnk17QEdrIHInXX2eBFN9OGjdleaB41VLaqlnA=";
  };

  outputs = [