summaryrefslogtreecommitdiff
path: root/pkgs/galmon.nix
blob: be6b89e57f819b710a70ba9b7d5f8470adc9d776 (plain)
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
{ protobuf
, pkg-config
, h2o
, openssl
, eigen
, ncurses5
, zstd
, zlib
, abseil-cpp
, curl
, gitMinimal
, stdenv
, fetchFromGitHub
, lib
, buildAll ? false
}:

let
  core = "ubxtool rtcmtool navrecv navnexus navparse";
  noncore = if buildAll then "navdump navcat reporter rinreport galmonmon navdisplay" else "";
in
stdenv.mkDerivation {
  pname = "galmon";
  version = "git-master";

  src = fetchFromGitHub {
    owner = "berthubert";
    repo = "galmon";
    rev = "refs/heads/master";
    hash = "sha256-NSuZYs6oFOB4dP2ypdVq6OZRgXSBHXFskH4I7uMTu+8=";
    fetchSubmodules = true;
  };

  patches = [ ./patches/galmon-fix-linker.patch ];

  buildInputs = [
    protobuf pkg-config h2o openssl eigen ncurses5 zstd zlib curl gitMinimal abseil-cpp
  ];

  buildPhase = ''
    make ${core} ${noncore}
  '';

  installPhase = ''
    mkdir -p $out/bin
    mv ${core} ${noncore} $out/bin
    # avoid collision with gpsd's ubxtool
    mv $out/bin/ubxtool $out/bin/galmon-ubxtool
    ${lib.optionalString buildAll "cp -r html $out/"}
  '';
}