1{ lib, stdenv, fetchurl, fetchFromGitHub, autoreconfHook, cmake, wrapQtAppsHook, pkg-config, qmake
2, curl, grantlee, libgit2, libusb-compat-0_1, libssh2, libxml2, libxslt, libzip, zlib
3, qtbase, qtconnectivity, qtlocation, qtsvg, qttools, qtwebkit, libXcomposite
4, bluez
5}:
6
7let
8 version = "5.0.2";
9
10 subsurfaceSrc = (fetchFromGitHub {
11 owner = "Subsurface";
12 repo = "subsurface";
13 rev = "v${version}";
14 sha256 = "1yay06m8p9qp2ghrg8dxavdq55y09apcgdnb7rihgs3hq86k539n";
15 fetchSubmodules = true;
16 });
17
18 libdc = stdenv.mkDerivation {
19 pname = "libdivecomputer-ssrf";
20 inherit version;
21
22 src = subsurfaceSrc;
23 sourceRoot = "source/libdivecomputer";
24
25 nativeBuildInputs = [ autoreconfHook ];
26
27 buildInputs = [ zlib ];
28
29 enableParallelBuilding = true;
30
31 meta = with lib; {
32 homepage = "http://www.libdivecomputer.org";
33 description = "A cross-platform and open source library for communication with dive computers from various manufacturers";
34 maintainers = with maintainers; [ mguentner ];
35 license = licenses.lgpl21;
36 platforms = platforms.all;
37 };
38 };
39
40 googlemaps = stdenv.mkDerivation rec {
41 pname = "googlemaps";
42
43 version = "2021-03-19";
44
45 src = fetchFromGitHub {
46 owner = "vladest";
47 repo = "googlemaps";
48 rev = "8f7def10c203fd3faa5ef96c5010a7294dca0759";
49 sha256 = "1irz398g45hk6xizwzd07qcx1ln8f7l6bhjh15f56yc20waqpx1x";
50 };
51
52 nativeBuildInputs = [ qmake ];
53
54 buildInputs = [ qtbase qtlocation libXcomposite ];
55
56 dontWrapQtApps = true;
57
58 pluginsSubdir = "lib/qt-${qtbase.qtCompatVersion}/plugins";
59
60 installPhase = ''
61 mkdir -p $out $(dirname ${pluginsSubdir}/geoservices)
62 mkdir -p ${pluginsSubdir}/geoservices
63 mv *.so ${pluginsSubdir}/geoservices
64 mv lib $out/
65 '';
66
67 meta = with lib; {
68 inherit (src.meta) homepage;
69 description = "QtLocation plugin for Google maps tile API";
70 maintainers = with maintainers; [ orivej ];
71 license = licenses.mit;
72 platforms = platforms.all;
73 };
74 };
75
76in stdenv.mkDerivation {
77 pname = "subsurface";
78 inherit version;
79
80 src = subsurfaceSrc;
81
82 buildInputs = [
83 libdc googlemaps
84 curl grantlee libgit2 libssh2 libusb-compat-0_1 libxml2 libxslt libzip
85 qtbase qtconnectivity qtsvg qttools qtwebkit
86 bluez
87 ];
88
89 nativeBuildInputs = [ cmake wrapQtAppsHook pkg-config ];
90
91 cmakeFlags = [
92 "-DLIBDC_FROM_PKGCONFIG=ON"
93 "-DNO_PRINTING=OFF"
94 ];
95
96 passthru = { inherit version libdc googlemaps; };
97
98 meta = with lib; {
99 description = "A divelog program";
100 longDescription = ''
101 Subsurface can track single- and multi-tank dives using air, Nitrox or TriMix.
102 It allows tracking of dive locations including GPS coordinates (which can also
103 conveniently be entered using a map interface), logging of equipment used and
104 names of other divers, and lets users rate dives and provide additional notes.
105 '';
106 homepage = "https://subsurface-divelog.org";
107 license = licenses.gpl2;
108 maintainers = with maintainers; [ mguentner adisbladis ];
109 platforms = platforms.all;
110 };
111}