summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/ph/phd2/package.nix
blob: f4fd4b448a5a789eabc4854596561d057c900323 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{
  lib,
  stdenv,
  fetchFromGitHub,
  fetchpatch2,
  cmake,
  ninja,
  pkg-config,
  wrapGAppsHook3,
  cfitsio,
  curl,
  eigen_3_4_0,
  gettext,
  glib,
  gtest,
  gtk3,
  libnova,
  libusb1,
  wxwidgets_3_2,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "phd2";
  version = "2.6.13";

  src = fetchFromGitHub {
    owner = "OpenPHDGuiding";
    repo = "phd2";
    rev = "v${finalAttrs.version}";
    sha256 = "sha256-GnT/tyk975caqESBSu4mdX5IWGi5O+RljLSd+CwoGWo=";
  };

  # fixes build error because of missing include
  # is in master, should be removed with next release
  patches = [
    (fetchpatch2 {
      url = "https://github.com/OpenPHDGuiding/phd2/commit/0927de6c8943fae7161457008b989bf72a05c638.patch?full_index=1";
      hash = "sha256-yo5YdZ4B7jx6p4TqFZc7RJsutsWzeNBUfinFAd8es7E=";
    })
  ];

  nativeBuildInputs = [
    cmake
    ninja
    pkg-config
    wrapGAppsHook3
  ];

  buildInputs = [
    cfitsio
    curl
    eigen_3_4_0
    gettext
    glib
    gtest
    gtk3
    libnova
    libusb1
    wxwidgets_3_2
  ];

  cmakeFlags = [
    "-DCMAKE_CXX_STANDARD=17" # needed for gtest
    "-DOPENSOURCE_ONLY=1"
    "-DUSE_SYSTEM_CFITSIO=ON"
    "-DUSE_SYSTEM_LIBUSB=ON"
    "-DUSE_SYSTEM_EIGEN3=ON"
    "-DUSE_SYSTEM_GTEST=ON"
  ];

  # Fix broken wrapped name scheme by moving wrapped binary to where wrapper expects it
  postFixup = ''
    mv $out/bin/.phd2.bin-wrapped $out/bin/.phd2-wrapped.bin
  '';

  meta = {
    homepage = "https://openphdguiding.org/";
    description = "Telescope auto-guidance application";
    changelog = "https://github.com/OpenPHDGuiding/phd2/releases/tag/v${finalAttrs.version}";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [
      returntoreality
    ];
    platforms = lib.platforms.linux;
  };
})