1{ lib
2, stdenv
3, fetchFromGitHub
4, autoreconfHook
5, writeShellScriptBin
6, cmake
7, wrapQtAppsHook
8, pkg-config
9, qmake
10, curl
11, grantlee
12, hidapi
13, libgit2
14, libssh2
15, libusb1
16, libxml2
17, libxslt
18, libzip
19, zlib
20, qtbase
21, qtconnectivity
22, qtlocation
23, qtsvg
24, qttools
25, qtwebengine
26, libXcomposite
27, bluez
28}:
29
30let
31 version = "5.0.10";
32
33 subsurfaceSrc = (fetchFromGitHub {
34 owner = "Subsurface";
35 repo = "subsurface";
36 rev = "v${version}";
37 hash = "sha256-KzUBhFGvocaS1VrVT2stvKrj3uVxYka+dyYZUfkIoNs=";
38 fetchSubmodules = true;
39 });
40
41 libdc = stdenv.mkDerivation {
42 pname = "libdivecomputer-ssrf";
43 inherit version;
44
45 src = subsurfaceSrc;
46
47 sourceRoot = "${subsurfaceSrc.name}/libdivecomputer";
48
49 nativeBuildInputs = [ autoreconfHook pkg-config ];
50
51 buildInputs = [ zlib libusb1 bluez hidapi ];
52
53 enableParallelBuilding = true;
54
55 meta = with lib; {
56 homepage = "https://www.libdivecomputer.org";
57 description = "A cross-platform and open source library for communication with dive computers from various manufacturers";
58 maintainers = with maintainers; [ mguentner ];
59 license = licenses.lgpl21;
60 platforms = platforms.all;
61 };
62 };
63
64 googlemaps = stdenv.mkDerivation rec {
65 pname = "googlemaps";
66 version = "0.0.0.2";
67
68 src = fetchFromGitHub {
69 owner = "vladest";
70 repo = "googlemaps";
71 rev = "v.${version}";
72 hash = "sha256-PfSLFQeCeVNcCVDCZehxyNLQGT6gff5jNxMW8lAaP8c=";
73 };
74
75 nativeBuildInputs = [ qmake ];
76
77 buildInputs = [ qtbase qtlocation libXcomposite ];
78
79 dontWrapQtApps = true;
80
81 pluginsSubdir = "lib/qt-${qtbase.qtCompatVersion}/plugins";
82
83 installPhase = ''
84 mkdir -p $out $(dirname ${pluginsSubdir}/geoservices)
85 mkdir -p ${pluginsSubdir}/geoservices
86 mv *.so ${pluginsSubdir}/geoservices
87 mv lib $out/
88 '';
89
90 meta = with lib; {
91 inherit (src.meta) homepage;
92 description = "QtLocation plugin for Google maps tile API";
93 maintainers = with maintainers; [ orivej ];
94 license = licenses.mit;
95 platforms = platforms.all;
96 };
97 };
98
99 get-version = writeShellScriptBin "get-version" ''
100 echo -n ${version}
101 '';
102
103in
104stdenv.mkDerivation {
105 pname = "subsurface";
106 inherit version;
107
108 src = subsurfaceSrc;
109
110 postPatch = ''
111 install -m555 -t scripts ${lib.getExe get-version}
112 '';
113
114 buildInputs = [
115 bluez
116 curl
117 googlemaps
118 grantlee
119 libdc
120 libgit2
121 libssh2
122 libxml2
123 libxslt
124 libzip
125 qtbase
126 qtconnectivity
127 qtsvg
128 qttools
129 qtwebengine
130 ];
131
132 nativeBuildInputs = [ cmake wrapQtAppsHook pkg-config ];
133
134 cmakeFlags = [
135 "-DLIBDC_FROM_PKGCONFIG=ON"
136 "-DNO_PRINTING=OFF"
137 ];
138
139 passthru = { inherit version libdc googlemaps; };
140
141 meta = with lib; {
142 description = "A divelog program";
143 longDescription = ''
144 Subsurface can track single- and multi-tank dives using air, Nitrox or TriMix.
145 It allows tracking of dive locations including GPS coordinates (which can also
146 conveniently be entered using a map interface), logging of equipment used and
147 names of other divers, and lets users rate dives and provide additional notes.
148 '';
149 homepage = "https://subsurface-divelog.org";
150 license = licenses.gpl2;
151 maintainers = with maintainers; [ mguentner adisbladis ];
152 platforms = platforms.all;
153 };
154}