1{
2 lib,
3 stdenv,
4 fetchurl,
5 autoPatchelfHook,
6 wrapQtAppsHook,
7 gnustep-libobjc,
8 libbsd,
9 libffi_3_3,
10 libxml2,
11 ncurses6,
12}:
13
14stdenv.mkDerivation (finalAttrs: {
15 pname = "hopper";
16 version = "5.19.4";
17 rev = "v4";
18
19 src = fetchurl {
20 url = "https://www.hopperapp.com/downloader/public/Hopper-${finalAttrs.rev}-${finalAttrs.version}-Linux-demo.pkg.tar.xz";
21 curlOptsList = [
22 "--user-agent"
23 "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
24 "--referer"
25 "https://www.hopperapp.com"
26 ];
27 hash = "sha256-NYnMJK9F3YxspjriyiLM+vV1HpEunGvznOesQ/FpTl4=";
28 };
29
30 sourceRoot = ".";
31
32 nativeBuildInputs = [
33 autoPatchelfHook
34 wrapQtAppsHook
35 ];
36
37 buildInputs = [
38 gnustep-libobjc
39 libbsd
40 libffi_3_3
41 ncurses6
42 ];
43
44 installPhase = ''
45 runHook preInstall
46
47 mkdir -p $out/bin $out/lib
48 install -Dm755 opt/hopper-${finalAttrs.rev}/bin/Hopper $out/bin/hopper
49 cp --archive \
50 opt/hopper-${finalAttrs.rev}/lib/libBlocksRuntime.so* \
51 opt/hopper-${finalAttrs.rev}/lib/libdispatch.so* \
52 opt/hopper-${finalAttrs.rev}/lib/libgnustep-base.so* \
53 opt/hopper-${finalAttrs.rev}/lib/libHopperCore.so* \
54 opt/hopper-${finalAttrs.rev}/lib/libkqueue.so* \
55 opt/hopper-${finalAttrs.rev}/lib/libobjcxx.so* \
56 opt/hopper-${finalAttrs.rev}/lib/libpthread_workqueue.so* \
57 $out/lib
58 cp -r usr/share $out/share
59 substituteInPlace $out/share/applications/hopper-${finalAttrs.rev}.desktop \
60 --replace-fail "Exec=/opt/hopper-${finalAttrs.rev}/bin/Hopper" "Exec=hopper"
61
62 runHook postInstall
63 '';
64
65 preFixup = ''
66 # Fix libxml2 breakage. See https://github.com/NixOS/nixpkgs/pull/396195#issuecomment-2881757108
67 mkdir -p "$out/lib"
68 ln -s "${lib.getLib libxml2}/lib/libxml2.so" "$out/lib/libxml2.so.2"
69 '';
70
71 meta = {
72 homepage = "https://www.hopperapp.com/index.html";
73 description = "MacOS and Linux Disassembler";
74 license = lib.licenses.unfree;
75 maintainers = with lib.maintainers; [ Enteee ];
76 platforms = lib.platforms.linux;
77 };
78})