Skip to content

Commit

Permalink
obs-backgroundremoval: 0.5.16 -> 1.1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Zahrun committed Jan 16, 2024
1 parent bb121a8 commit e39a7e4
Showing 1 changed file with 34 additions and 12 deletions.
@@ -1,45 +1,67 @@
{ 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; {
description = "OBS plugin to replace the background in portrait images and video";
homepage = "https://github.com/royshil/obs-backgroundremoval";
maintainers = with maintainers; [ zahrun ];
license = licenses.mit;
platforms = [ "x86_64-linux" "i686-linux" ];
platforms = [ "x86_64-linux" ];
};
}

0 comments on commit e39a7e4

Please sign in to comment.