1{ lib, mkDerivation, fetchFromGitHub, runCommand, fetchpatch, patchutils, qmake, qtbase
2, SDL, SDL_mixer, boost, curl, gsasl, libgcrypt, libircclient, protobuf, sqlite
3, wrapQtAppsHook
4, tinyxml2, target ? "client" }:
5
6let
7 hiDPI = fetchpatch {
8 url = "https://github.com/pokerth/pokerth/commit/ad8c9cabfb85d8293720d0f14840278d38b5feeb.patch";
9 sha256 = "192x3lqvd1fanasb95shdygn997qfrpk1k62k1f4j3s5chkwvjig";
10 };
11
12 revertPatch = patch: runCommand "revert-${patch.name}" {} ''
13 ${patchutils}/bin/interdiff ${patch} /dev/null > $out
14 '';
15in
16
17mkDerivation rec {
18 pname = "pokerth-${target}";
19 version = "1.1.2";
20
21 src = fetchFromGitHub {
22 owner = "pokerth";
23 repo = "pokerth";
24 rev = "f5688e01b0efb37035e3b0e3a432200185b9a0c5";
25 sha256 = "0la8d036pbscjnbxf8lkrqjfq8a4ywsfwxil452fhlays6mr19h0";
26 };
27
28 patches = [
29 (revertPatch hiDPI)
30 ];
31
32 postPatch = ''
33 for f in *.pro; do
34 substituteInPlace $f \
35 --replace '$$'{PREFIX}/include/libircclient ${libircclient.dev}/include/libircclient \
36 --replace 'LIB_DIRS =' 'LIB_DIRS = ${boost.out}/lib' \
37 --replace /opt/gsasl ${gsasl}
38 done
39 '';
40
41 nativeBuildInputs = [ qmake wrapQtAppsHook ];
42
43 buildInputs = [
44 SDL
45 SDL_mixer
46 boost
47 curl
48 gsasl
49 libgcrypt
50 libircclient
51 protobuf
52 qtbase
53 sqlite
54 tinyxml2
55 ];
56
57 qmakeFlags = [
58 "CONFIG+=${target}"
59 "pokerth.pro"
60 ];
61
62 env.NIX_CFLAGS_COMPILE = "-I${lib.getDev SDL}/include/SDL";
63
64 meta = with lib; {
65 homepage = "https://www.pokerth.net";
66 description = "Poker game ${target}";
67 license = licenses.gpl3;
68 maintainers = with maintainers; [ obadz yana ];
69 platforms = platforms.all;
70 };
71}