From eeb2935ac5a74eeb3d2e32f311fd6e6ef743e78c Mon Sep 17 00:00:00 2001 From: Burke Libbey Date: Wed, 2 Dec 2015 13:56:47 -0500 Subject: [PATCH] Fix notmuch for darwin, fixes #11410 platforms can be unix; this works on darwin at *least*, after we fix the libtalloc references. --- .../mailreaders/notmuch/default.nix | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/networking/mailreaders/notmuch/default.nix b/pkgs/applications/networking/mailreaders/notmuch/default.nix index c7921b8553b2..f84a3367d52c 100644 --- a/pkgs/applications/networking/mailreaders/notmuch/default.nix +++ b/pkgs/applications/networking/mailreaders/notmuch/default.nix @@ -42,10 +42,30 @@ stdenv.mkDerivation rec { preFixup = if stdenv.isDarwin then '' + set -e + + die() { + >&2 echo "$@" + exit 1 + } + prg="$out/bin/notmuch" - target="libnotmuch.3.dylib" - echo "$prg: fixing link to $target" - install_name_tool -change "$target" "$out/lib/$target" "$prg" + lib="$(find "$out/lib" -name 'libnotmuch.?.dylib')" + + [[ -s "$prg" ]] || die "couldn't find notmuch binary" + [[ -s "$lib" ]] || die "couldn't find libnotmuch" + + badname="$(otool -L "$prg" | awk '$1 ~ /libtalloc/ { print $1 }')" + goodname="$(find "${talloc}/lib" -name 'libtalloc.?.?.?.dylib')" + + [[ -n "$badname" ]] || die "couldn't find libtalloc reference in binary" + [[ -n "$goodname" ]] || die "couldn't find libtalloc in nix store" + + echo "fixing libtalloc link in $lib" + install_name_tool -change "$badname" "$goodname" "$lib" + + echo "fixing libtalloc link in $prg" + install_name_tool -change "$badname" "$goodname" "$prg" '' else ""; @@ -58,6 +78,6 @@ stdenv.mkDerivation rec { description = "Mail indexer"; license = stdenv.lib.licenses.gpl3; maintainers = with stdenv.lib.maintainers; [ chaoflow garbas ]; - platforms = stdenv.lib.platforms.gnu; + platforms = stdenv.lib.platforms.unix; }; }