1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 ninja,
7 obs-studio,
8 onnxruntime,
9 opencv,
10 qt6,
11 curl,
12}:
13
14stdenv.mkDerivation rec {
15 pname = "obs-backgroundremoval";
16 version = "1.1.13";
17
18 src = fetchFromGitHub {
19 owner = "occ-ai";
20 repo = "obs-backgroundremoval";
21 rev = version;
22 hash = "sha256-QoC9/HkwOXMoFNvcOxQkGCLLAJmsja801LKCNT9O9T0=";
23 };
24
25 nativeBuildInputs = [
26 cmake
27 ninja
28 ];
29 buildInputs = [
30 obs-studio
31 onnxruntime
32 opencv.cxxdev
33 qt6.qtbase
34 curl
35 ];
36
37 dontWrapQtApps = true;
38
39 cmakeFlags = [
40 "--preset linux-x86_64"
41 "-DCMAKE_MODULE_PATH:PATH=${src}/cmake"
42 "-DUSE_SYSTEM_ONNXRUNTIME=ON"
43 "-DUSE_SYSTEM_OPENCV=ON"
44 "-DDISABLE_ONNXRUNTIME_GPU=ON"
45 ];
46
47 buildPhase = ''
48 cd ..
49 cmake --build build_x86_64 --parallel
50 '';
51
52 installPhase = ''
53 cmake --install build_x86_64 --prefix "$out"
54 '';
55
56 meta = with lib; {
57 description = "OBS plugin to replace the background in portrait images and video";
58 homepage = "https://github.com/royshil/obs-backgroundremoval";
59 maintainers = with maintainers; [ zahrun ];
60 license = licenses.mit;
61 platforms = [ "x86_64-linux" ];
62 };
63}