Unverified Commit 8ae60a77 authored by kirillrdy's avatar kirillrdy Committed by GitHub
Browse files

opentrack: 2022.3.0 -> 2023.3.0 (#349971)

parents 95ee0b68 77009d21
Loading
Loading
Loading
Loading
+21 −7
Original line number Diff line number Diff line
{
  pkgs,
  mkDerivation,
  lib,
  callPackage,
@@ -17,15 +18,17 @@
  libevdev,
  makeDesktopItem,
  fetchurl,
  fetchpatch,
  wineWowPackages,
}: let
  version = "2022.3.0";
  version = "2023.3.0";

  aruco = callPackage ./aruco.nix {};

  # license.txt inside the zip file is MIT
  xplaneSdk = fetchzip {
    url = "https://developer.x-plane.com/wp-content/plugins/code-sample-generation/sample_templates/XPSDK303.zip";
    sha256 = "11wqjsr996c5qhiv2djsd55gc373a9qcq30dvc6rhzm0fys42zba";
    url = "https://developer.x-plane.com/wp-content/plugins/code-sample-generation/sdk_zip_files/XPSDK401.zip";
    hash = "sha256-tUT9yV1949QVr5VebU/7esg7wwWkyak2TSA/kQSrbeo=";
  };
in
  mkDerivation {
@@ -36,19 +39,30 @@ in
      owner = "opentrack";
      repo = "opentrack";
      rev = "opentrack-${version}";
      sha256 = "sha256-8gpNORTJclYUYp57Vw/0YO3XC9Idurt0a79fhqx0+mo=";
      hash = "sha256-C0jLS55DcLJh/e5yM8kLG7fhhKvBNllv5HkfCWRIfc4=";
    };

    patches = [
      # https://github.com/opentrack/opentrack/pull/1754
      (fetchpatch {
        url = "https://github.com/opentrack/opentrack/commit/d501d7e0b237ed0c305525788b423d842ffa356d.patch";
        hash = "sha256-XMGHV78vt/Xn3hS+4V//pqtsdBQCfJPjIXxfwtdXX+Q=";
      })
    ];

    nativeBuildInputs = [cmake pkg-config ninja copyDesktopItems];
    buildInputs = [qtbase qttools opencv4 procps eigen libXdmcp libevdev aruco];
    buildInputs = [qtbase qttools opencv4 procps eigen libXdmcp libevdev aruco]
      ++ lib.optionals pkgs.stdenv.targetPlatform.isx86_64 [ wineWowPackages.stable ];

    env.NIX_CFLAGS_COMPILE = "-Wall -Wextra -Wpedantic -ffast-math -O3";
    dontWrapQtApps = true;

    cmakeFlags = [
      "-GNinja"
      "-DCMAKE_BUILD_TYPE=Release"
      "-DSDK_ARUCO_LIBPATH=${aruco}/lib/libaruco.a"
      "-DSDK_XPLANE=${xplaneSdk}"
    ];
    ] ++ lib.optionals pkgs.stdenv.targetPlatform.isx86_64 [ "-DSDK_WINE=ON" ];

    postInstall = ''
      wrapQtApp $out/bin/opentrack
@@ -60,7 +74,7 @@ in
        exec = "opentrack";
        icon = fetchurl {
          url = "https://github.com/opentrack/opentrack/raw/opentrack-${version}/gui/images/opentrack.png";
          sha256 = "0d114zk78f7nnrk89mz4gqn7yk3k71riikdn29w6sx99h57f6kgn";
          hash = "sha256-9k3jToEpdW14ErbNGHM4c0x/LH7k14RmtvY4dOYnITQ=";
        };
        desktopName = name;
        genericName = "Head tracking software";