ccache: make src reproducible

This commit is contained in:
Robert Schütz 2024-06-01 18:49:09 -07:00
parent a37a6e107f
commit 898be2ef0f

View File

@ -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 = [