summary refs log tree commit diff
path: root/pkgs/applications/misc/openambit/default.nix
blob: f3429a05ee6e3dcbb690d10516882906b76293e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{ cmake
, fetchFromGitHub
, fetchpatch
, lib
, libusb1
, mkDerivation
, python3
, qtbase
, qttools
, udev
, zlib
}:

mkDerivation rec {
  pname = "openambit";
  version = "0.5";

  src = fetchFromGitHub {
    owner = "openambitproject";
    repo = pname;
    rev = version;
    sha256 = "1074kvkamwnlkwdajsw1799wddcfkjh2ay6l842r0s4cvrxrai85";
  };

  patches = [
    # Pull upstream patch for -fno-common toolchain support:
    #   https://github.com/openambitproject/openambit/pull/244
    (fetchpatch {
      name = "fno-common.patch";
      url = "https://github.com/openambitproject/openambit/commit/b6d97eab417977b6dbe355e0b071d0a56cc3df6b.patch";
      sha256 = "1p0dg902mlcfjvs01dxl9wv2b50ayp4330p38d14q87mn0c2xl5d";
    })
  ];

  nativeBuildInputs = [ cmake qttools ];
  buildInputs = [ libusb1 python3 qtbase udev zlib ];

  cmakeFlags = [ "-DCMAKE_INSTALL_UDEVRULESDIR=${placeholder "out"}/lib/udev/rules.d" ];

  doInstallCheck = true;
  installCheckPhase = ''
    $out/bin/openambit --version
  '';

  postInstall = ''
    install -m755 -D $src/tools/openambit2gpx.py $out/bin/openambit2gpx

    mv -v $out/lib/udev/rules.d/libambit.rules \
          $out/lib/udev/rules.d/20-libambit.rules
  '';

  meta = with lib; {
    description = "Helps fetch data from Suunto Ambit GPS watches";
    homepage = "https://github.com/openambitproject/openambit/";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ rycee ];
    platforms = platforms.linux;
  };
}