From 4e7ddc2c38a0038f5061f43c7b301a5dabf7c615 Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Sun, 22 May 2022 13:37:33 +0100 Subject: [PATCH] difftastic: patch bundled mimalloc source to build on older macos same patch as introduced to our own mimalloc in 9ba8bda31328209bed6d4c0212735ff0e3c2cf95 --- pkgs/tools/text/difftastic/default.nix | 33 ++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/text/difftastic/default.nix b/pkgs/tools/text/difftastic/default.nix index 1c1d6fc6bfa..500aae3fc08 100644 --- a/pkgs/tools/text/difftastic/default.nix +++ b/pkgs/tools/text/difftastic/default.nix @@ -1,4 +1,11 @@ -{ lib, fetchFromGitHub, rustPlatform, tree-sitter, difftastic, testers }: +{ lib +, fetchFromGitHub +, fetchpatch +, rustPlatform +, tree-sitter +, difftastic +, testers +}: rustPlatform.buildRustPackage rec { pname = "difftastic"; @@ -11,7 +18,29 @@ rustPlatform.buildRustPackage rec { sha256 = "sha256-jdkyDsuOOG1dJmgRmMp2KhY9ermccjrxK2JAIzpO6nw="; }; - cargoSha256 = "sha256-qHG3ve8HoMWBS/x6mRbXMsrpcqNqfVcbAkfYOk7Su/0="; + depsExtraArgs = { + postBuild = let + mimallocPatch = (fetchpatch { + name = "mimalloc-older-macos-fixes.patch"; + url = "https://github.com/microsoft/mimalloc/commit/40e0507a5959ee218f308d33aec212c3ebeef3bb.patch"; + stripLen = 1; + extraPrefix = "libmimalloc-sys/c_src/mimalloc/"; + sha256 = "1cqgay6ayzxsj8v1dy8405kwd8av34m4bjc84iyg9r52amlijbg4"; + }); + in '' + pushd $name + patch -p1 < ${mimallocPatch} + substituteInPlace libmimalloc-sys/.cargo-checksum.json \ + --replace \ + '6a2e9f0db0d3de160f9f15ddc8a870dbc42bba724f19f1e69b8c4952cb36821a' \ + '201ab8874d9ba863406e084888e492b785a7edae00a222f395c079028d21a89a' \ + --replace \ + 'a87a27e8432a63e5de25703ff5025588afd458e3a573e51b3c3dee2281bff0d4' \ + 'ab98a2da81d2145003a9cba7b7025efbd2c7b37c7a23c058c150705a3ec39298' + popd + ''; + }; + cargoSha256 = "12a12ng9wz2rrj3xzhgrqlg3lxpqxwdgvkz3fxny17nysmmpnhvv"; passthru.tests.version = testers.testVersion { package = difftastic; };