1{
2 cmake,
3 fetchFromGitHub,
4 fetchpatch,
5 lib,
6 libusb1,
7 mkDerivation,
8 python3,
9 qtbase,
10 qttools,
11 udev,
12 zlib,
13}:
14
15mkDerivation rec {
16 pname = "openambit";
17 version = "0.5";
18
19 src = fetchFromGitHub {
20 owner = "openambitproject";
21 repo = "openambit";
22 rev = version;
23 sha256 = "1074kvkamwnlkwdajsw1799wddcfkjh2ay6l842r0s4cvrxrai85";
24 };
25
26 patches = [
27 # Pull upstream patch for -fno-common toolchain support:
28 # https://github.com/openambitproject/openambit/pull/244
29 (fetchpatch {
30 name = "fno-common.patch";
31 url = "https://github.com/openambitproject/openambit/commit/b6d97eab417977b6dbe355e0b071d0a56cc3df6b.patch";
32 sha256 = "1p0dg902mlcfjvs01dxl9wv2b50ayp4330p38d14q87mn0c2xl5d";
33 })
34 ];
35
36 nativeBuildInputs = [
37 cmake
38 qttools
39 ];
40 buildInputs = [
41 libusb1
42 python3
43 qtbase
44 udev
45 zlib
46 ];
47
48 cmakeFlags = [ "-DCMAKE_INSTALL_UDEVRULESDIR=${placeholder "out"}/lib/udev/rules.d" ];
49
50 doInstallCheck = true;
51 installCheckPhase = ''
52 runHook preInstallCheck
53
54 $out/bin/openambit --version
55
56 runHook postInstallCheck
57 '';
58
59 postInstall = ''
60 install -m755 -D $src/tools/openambit2gpx.py $out/bin/openambit2gpx
61
62 mv -v $out/lib/udev/rules.d/libambit.rules \
63 $out/lib/udev/rules.d/20-libambit.rules
64 '';
65
66 meta = with lib; {
67 description = "Helps fetch data from Suunto Ambit GPS watches";
68 homepage = "https://github.com/openambitproject/openambit/";
69 license = licenses.gpl3Plus;
70 maintainers = with maintainers; [ rycee ];
71 platforms = platforms.linux;
72 };
73}