Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / applications / misc / opentrack / default.nix
blob84edbc567b41831dc8a69b11b65409cf63f1892c
2   mkDerivation,
3   lib,
4   callPackage,
5   fetchzip,
6   fetchFromGitHub,
7   cmake,
8   pkg-config,
9   ninja,
10   copyDesktopItems,
11   qtbase,
12   qttools,
13   opencv4,
14   procps,
15   eigen,
16   libXdmcp,
17   libevdev,
18   makeDesktopItem,
19   fetchurl,
20 }: let
21   version = "2022.3.0";
23   aruco = callPackage ./aruco.nix {};
25   # license.txt inside the zip file is MIT
26   xplaneSdk = fetchzip {
27     url = "https://developer.x-plane.com/wp-content/plugins/code-sample-generation/sample_templates/XPSDK303.zip";
28     sha256 = "11wqjsr996c5qhiv2djsd55gc373a9qcq30dvc6rhzm0fys42zba";
29   };
31   mkDerivation {
32     pname = "opentrack";
33     inherit version;
35     src = fetchFromGitHub {
36       owner = "opentrack";
37       repo = "opentrack";
38       rev = "opentrack-${version}";
39       sha256 = "sha256-8gpNORTJclYUYp57Vw/0YO3XC9Idurt0a79fhqx0+mo=";
40     };
42     nativeBuildInputs = [cmake pkg-config ninja copyDesktopItems];
43     buildInputs = [qtbase qttools opencv4 procps eigen libXdmcp libevdev aruco];
45     env.NIX_CFLAGS_COMPILE = "-Wall -Wextra -Wpedantic -ffast-math -O3";
46     dontWrapQtApps = true;
48     cmakeFlags = [
49       "-DSDK_ARUCO_LIBPATH=${aruco}/lib/libaruco.a"
50       "-DSDK_XPLANE=${xplaneSdk}"
51     ];
53     postInstall = ''
54       wrapQtApp $out/bin/opentrack
55     '';
57     desktopItems = [
58       (makeDesktopItem rec {
59         name = "opentrack";
60         exec = "opentrack";
61         icon = fetchurl {
62           url = "https://github.com/opentrack/opentrack/raw/opentrack-${version}/gui/images/opentrack.png";
63           sha256 = "0d114zk78f7nnrk89mz4gqn7yk3k71riikdn29w6sx99h57f6kgn";
64         };
65         desktopName = name;
66         genericName = "Head tracking software";
67         categories = ["Utility"];
68       })
69     ];
71     meta = with lib; {
72       homepage = "https://github.com/opentrack/opentrack";
73       description = "Head tracking software for MS Windows, Linux, and Apple OSX";
74       changelog = "https://github.com/opentrack/opentrack/releases/tag/${version}";
75       license = licenses.isc;
76       maintainers = with maintainers; [zaninime];
77     };
78   }