From e39a7e493fa8cc6e88de4e40735fcf7e9b8bdb92 Mon Sep 17 00:00:00 2001 From: Aroun Olorin Date: Tue, 9 May 2023 03:32:45 +0530 Subject: [PATCH] obs-backgroundremoval: 0.5.16 -> 1.1.10 --- .../plugins/obs-backgroundremoval/default.nix | 46 ++++++++++++++----- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval/default.nix b/pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval/default.nix index 766fca414cd8d26..4260db538cc9f57 100644 --- a/pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval/default.nix +++ b/pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval/default.nix @@ -1,38 +1,60 @@ { lib , stdenv , fetchFromGitHub +, fetchpatch , cmake +, ninja , obs-studio , onnxruntime , opencv +, qt6 +, curl }: stdenv.mkDerivation rec { pname = "obs-backgroundremoval"; - version = "0.5.16"; + version = "1.1.10"; src = fetchFromGitHub { - owner = "royshil"; + owner = "occ-ai"; repo = "obs-backgroundremoval"; - rev = "v${version}"; - hash = "sha256-E+pm/Ma6dZTYlX3DpB49ynTETsRS2TBqgHSCijl/Txc="; + rev = "${version}"; + hash = "sha256-6OTtmjXS3fiorEPUSjjqrS8u9fVJnnZZoD722W3JQO8="; }; - nativeBuildInputs = [ cmake ]; - buildInputs = [ obs-studio onnxruntime opencv ]; + patches = [ + # build without GPU support + (fetchpatch { + url = "https://patch-diff.githubusercontent.com/raw/occ-ai/obs-backgroundremoval/pull/524.patch"; + sha256 = "sha256-ewETfFcD/0zscsUAPO/1UpytHRdhq/eSrzDcRIUdAxY="; + }) + # fix build without GPU support + (fetchpatch { + url = "https://patch-diff.githubusercontent.com/raw/occ-ai/obs-backgroundremoval/pull/530.patch"; + sha256 = "sha256-sPZ6Va3d2D0yHWN/bcrMBwNjCNqPXED6I7ipeSU+ThI="; + }) + ]; + + nativeBuildInputs = [ cmake ninja ]; + buildInputs = [ obs-studio onnxruntime opencv qt6.qtbase curl ]; dontWrapQtApps = true; cmakeFlags = [ + "--preset linux-x86_64" + "-DCMAKE_MODULE_PATH:PATH=/build/source/cmake" "-DUSE_SYSTEM_ONNXRUNTIME=ON" "-DUSE_SYSTEM_OPENCV=ON" + "-DDISABLE_ONNXRUNTIME_GPU=ON" ]; - postInstall = '' - mkdir $out/lib $out/share - mv $out/obs-plugins/64bit $out/lib/obs-plugins - rm -rf $out/obs-plugins - mv $out/data $out/share/obs + buildPhase = '' + cd .. + cmake --build build_x86_64 --parallel + ''; + + installPhase = '' + cmake --install build_x86_64 --prefix "$out"/usr ''; meta = with lib; { @@ -40,6 +62,6 @@ stdenv.mkDerivation rec { homepage = "https://github.com/royshil/obs-backgroundremoval"; maintainers = with maintainers; [ zahrun ]; license = licenses.mit; - platforms = [ "x86_64-linux" "i686-linux" ]; + platforms = [ "x86_64-linux" ]; }; }