@@ -1,48 +1,89 @@
11{ stdenv
22, fetchurl
33, cmake
4+, extra-cmake-modules
5+
6+# common deps
7+, karchive
8+
9+# client deps
410, qtbase
5−, qtsvg
611, qtmultimedia
12+, qtsvg
713, qttools
8−, kdnssd
9−, karchive
10−, libsodium
11−, libmicrohttpd
14+
15+# optional client deps
1216, giflib
13−, miniupnpc
14−, extra-cmake-modules
17+, kdnssd
1518, libvpx
19+, miniupnpc
20+, qtx11extras # kis
21+
22+# optional server deps
23+, libmicrohttpd
24+, libsodium
25+
26+# options
27+, buildClient ? true
28+, buildServer ? true
29+, buildServerGui ? true # if false builds a headless server
30+, buildExtraTools ? false
31+, enableKisTablet ? false # enable improved graphics tablet support
1632}:
1733
18−stdenv.mkDerivation rec {
34+with stdenv.lib;
35+
36+let
37+ commonDeps = [
38+ karchive
39+ ];
40+ clientDeps = [
41+ qtbase
42+ qtmultimedia
43+ qtsvg
44+ qttools
45+ # optional:
46+ giflib # gif animation export support
47+ kdnssd # local server discovery with Zeroconf
48+ libvpx # WebM video export
49+ miniupnpc # automatic port forwarding
50+ ];
51+ serverDeps = [
52+ # optional:
53+ libmicrohttpd # HTTP admin api
54+ libsodium # ext-auth support
55+ ];
56+ kisDeps = [
57+ qtx11extras
58+ ];
59+
60+in stdenv.mkDerivation rec {
1961 name = "drawpile-${version}";
2062 version = "2.1.6";
63+
2164 src = fetchurl {
2265 url = "https://drawpile.net/files/src/drawpile-${version}.tar.gz";
2366 sha256 = "0vwsdvphigrq1daiazi411qflahlvgx8x8ssp581bng2lbq1vrbd";
2467 };
68+
2569 nativeBuildInputs = [
26− extra-cmake-modules
27− ];
28− buildInputs = [
29− # common deps:
3070 cmake
31− qtbase qtsvg qtmultimedia qttools
32− karchive
33− # optional deps:
34− # server-specific:
35− libsodium # ext-auth support
36− libmicrohttpd # HTTP admin api
37− # client-specific:
38− giflib # gif animation export support
39− miniupnpc # automatic port forwarding
40− kdnssd # local server discovery with Zeroconf
41− libvpx # WebM video export
71+ extra-cmake-modules
4272 ];
43− configurePhase = "cmake -DCMAKE_INSTALL_PREFIX=$out .";
73+ buildInputs =
74+ commonDeps ++
75+ optionals buildClient clientDeps ++
76+ optionals buildServer serverDeps ++
77+ optionals enableKisTablet kisDeps ;
78+
79+ cmakeFlags =
80+ optional (!buildClient ) "-DCLIENT=off" ++
81+ optional (!buildServer ) "-DSERVER=off" ++
82+ optional (!buildServerGui ) "-DSERVERGUI=off" ++
83+ optional ( buildExtraTools) "-DTOOLS=on" ++
84+ optional ( enableKisTablet) "-DKIS_TABLET=on";
4485
45− meta = with stdenv.lib; {
86+ meta = {
4687 description = "A collaborative drawing program that allows multiple users to sketch on the same canvas simultaneously";
4788 homepage = https://drawpile.net/;
4889 downloadPage = https://drawpile.net/download/;