about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/resp-app/default.nix
blob: b95bc98fdd3ac1cd7d70a9a3e0eef5da214fd3af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{ stdenv
, mkDerivation
, lib
, fetchFromGitHub
, fetchpatch
, brotli
, lz4
, pyotherside
, python3
, python3Packages
, qtbase
, qtcharts
, qmake
, qttools
, rdbtools
, snappy
, wrapQtAppsHook
, zstd
}:

let
  rdbtools-patched = rdbtools.overridePythonAttrs (oldAttrs: {
    # Add required additional flag for resp-app
    patches = [
      (fetchpatch {
        name = "Add-flag-to-parse-only-key-names.patch";
        url = "https://github.com/uglide/redis-rdb-tools/commit/b74946e6fbca589947ef0186429d5ce45a074b87.patch";
        hash = "sha256-1gjqB/IDSsAbrwzWSezlAW/2SYr6BFm1QJ2HAHK2fFs=";
      })
    ];
  });
in
mkDerivation rec {
  pname = "RESP.app";
  version = "2022.5";

  src = fetchFromGitHub {
    owner = "RedisInsight";
    repo = "RedisDesktopManager";
    fetchSubmodules = true;
    rev = version;
    sha256 = "sha256-5eI3J2RsYE5Ejb1r8YkgzmGX2FyaCLFD0lc10J+fOT4=";
  };

  nativeBuildInputs = [
    python3Packages.wrapPython
    qmake
    wrapQtAppsHook
  ];

  buildInputs = [
    brotli
    lz4
    pyotherside
    python3
    qtbase
    qtcharts
    qttools
    snappy
    zstd
  ] ++ pythonPath;


  pythonPath = with python3Packages; [
    bitstring
    cbor
    msgpack
    phpserialize
    rdbtools-patched
    python-lzf
  ];

  postPatch = ''
    substituteInPlace src/resp.pro \
      --replace 'which ccache' "false" \
      --replace 'target.files = $$DESTDIR/resp' "${placeholder "src"}/bin/linux/release/resp" \
      --replace '/opt/resp_app' "${placeholder "out"}" \
      --replace 'target.path = $$LINUX_INSTALL_PATH' 'target.path = $$LINUX_INSTALL_PATH/bin' \
      --replace '/usr/' "$out/"
  '';

  qmakeFlags = [
    "SYSTEM_LZ4=1"
    "SYSTEM_ZSTD=1"
    "SYSTEM_SNAPPY=1"
    "SYSTEM_BROTLI=1"
    "VERSION=${version}"
    "src/resp.pro"
  ];

  preFixup = ''
    buildPythonPath "$pythonPath"
    qtWrapperArgs+=(--prefix PYTHONPATH : "$program_PYTHONPATH")
  '';

  meta = with lib; {
    description = "Cross-platform Developer GUI for Redis";
    homepage = "https://resp.app/";
    license = licenses.gpl3Only;
    platforms = platforms.linux;
    maintainers = with maintainers; [ ];
  };
}